I would appreciate some feedback on whether the following scheme is feasible or will prove unworkable. I have a few specific questions at the bottom.
Components
- An archive of documents to be shared amongst computers
- A server that stores the archive and retains all of its contents
- A set of client machines that store only the files that they need and drop the rest
Desired behavior
- Clients will run the assistant to handle sync'ing
- On the server, the archive should be accessible in the working tree so that other users can read the files (they do not need write access).
- It should be possible to modify the archive on the server while logged into the server
- Clients can push and pull data. The server does not push or pull data.
Basic setup
Set up the server and one client
- Create git annex repos on the client and server
- Add the server as a remote in the client repo
Keep the server's working directory up to date
- Add
git merge synced/master master
to theannex-content
hook described here. - Add
git merge synced/master master
to thepost-receive
hook.
Keep server working tree visible to a different group
- Set
git config core.sharedrepository group
for the repository - Add
chgrp -R shared "$(git rev-parse --show-toplevel)"
to theannex-content
,post-receive
, andpost-merge
hooks, whereshared
is the name of the group that you want to be able to access the server files.
Questions
- I had to add the
post-receive
hook because updates from the assistant were not trigger theannex-content
hook. Should they trigger it? - Are there downsides to merging
synced/master
like this? - If I want to edit files on the server, is it safe to edit them in the repo with this set up? Or should I create a second client repo on the server, check out the necessary files there, and then push them to the server like I would from any other client?
A way to do this pretty cleanly is described here: http://git-annex.branchable.com/tips/setup_a_public_repository_on_a_web_site/
The annex-content hook is not meant to be run when a regular git push is made to the repository. That would be unnecessarily redundant with existing git hooks.
I'd expect it to be pretty safe to edit files in such a repository, but you have to keep in mind that if changes are pushed into it at the same time as an edit is occuring, you can get into various situations with the hooks etc.