I'm currently integrating git-annex support into a filesystem synchronization tool that I use, and I have a use case where I'd like to run "git annex sync' on a local directory, and then automatically ssh over to remote hosts and run "git annex sync" in the related annex on that remote host. However, while I can easily "cd" on the local, there is no really easy way to "cd" on the remote without a hack.

If I could say: git annex --annex-dir=PATH sync, where PATH is the annex directory, it would solve all my problems, and would also provide a nice correlation to the --git-dir option used by most Git commands. The basic idea is that I shouldn't have to be IN the directory to run git-annex commands, I should be able to tell git-annex which directory to apply its commands to.

ssh remotehost "cd /path/to/annex && git annex sync"
You can use GIT_DIR. It would not be hard to add a --git-dir option, the only catch is how to communicate that state on to where it constructs its git repository data structure. (I suppose it could just set GIT_DIR..)
Comment by http://joeyh.name/ Wed Oct 17 18:31:58 2012
@Justin If you have full shell access on the remote your solution works fine, but not if git-annex is the only binary you are allowed to execute.
Comment by https://me.yahoo.com/a/2grhJvAC049fJnvALDXek.6MRZMTlg--#eec89 Sat Oct 20 05:21:13 2012
Comments on this page are closed.