So far in this walkthrough, git-annex has been used with a remote repository on a USB drive. But it can also be used with a git remote that is truely remote, a host accessed by ssh.
Say you have a desktop on the same network as your laptop and want to clone the laptop's annex to it:
# git clone ssh://mylaptop/home/me/annex ~/annex
# cd ~/annex
# git annex init "my desktop"
Now you can get files and they will be transferred (using rsync
via ssh
):
# git annex get my_cool_big_file
get my_cool_big_file (getting UUID for origin...) (from origin...)
SHA256-s86050597--6ae2688bc533437766a48aa19f2c06be14d1bab9c70b468af445d4f07b65f41e 100% 2159 2.1KB/s 00:00
ok
When you drop files, git-annex will ssh over to the remote and make sure the file's content is still there before removing it locally:
# git annex drop my_cool_big_file
drop my_cool_big_file (checking origin..) ok
Note that normally git-annex prefers to use non-ssh remotes, like
a USB drive, before ssh remotes. They are assumed to be faster/cheaper to
access, if available. There is a annex-cost setting you can configure in
.git/config
to adjust which repositories it prefers. See
the man page for details.
Also, note that you need full shell access for this to work -- git-annex needs to be able to ssh in and run commands. Or at least, your shell needs to be able to run the git-annex-shell command.
Hi,
I could successfully clone my ssh repo's annex to my laptop, following these instructions. I'm also able to sync the repositories (laptop and ssh) when I commit new files in the ssh repo.
However, every time I try to get files from the ssh repo (using 'git annex get some_file'), nothing happens. Do you know what can be happening?
Thanks!
When
git annex get
does nothing, it's because it doesn't know a place to get the file from.This can happen if the
git-annex
branch has not propigated from the place where the file was added. For example, if on the laptop you had rungit pull ssh master
, that would only pull the master branch, not the git-annex branch.An easy way to ensure the git-annex branch is kept in sync is to run
git annex sync
Thanks for the quick replay!
I already did 'git annex sync', but it didn't work. The steps were: 'git clone ssh...', then 'cd annex', then 'git annex init "laptop"'
After that, I did a 'git annex sync', and tried to get the file, but nothing happens. That's why I found it weird. Any other thing that might have happened?
Thanks again!
git annex whereis
on the file and see where it says it is.Hi,
I guess the problem is with git-annex-shell. I tried to do 'git annex get file --from name_ssh_repo', and I got the following:
bash: git-annex-shell: command not found; failed; exit code 127
The same thing happens if I try to do 'git annex whereis'
git-annex-shell is indeed installed. How can I make my shell recognize this command?
Thanks a lot!
git-annex-shell needs to be installed in the
PATH
on any host that will hold annexed files.If you installed with cabal, it might be
.cabal/bin/
. Whereever it was installed to is apparently not on the PATH that is set when you ssh into that host.Hi,
It was already installed in PATH. In fact, I can call it from the command line, and it is recognized (e.g. calling 'git-annex-shell' gives me 'git-annex-shell: bad parameters'). However, every time I do a 'git annex whereis' or 'git annex get file --from repo', it gives me the following error:
bash: git-annex-shell: command not found Command ssh ["-S","/Users/username/annex/.git/annex/ssh/username@example.edu","-o","ControlMaster=auto","-o","ControlPersist=yes","username@example.edu","git-annex-shell 'configlist' '/~/annex'"] failed; exit code 127
I tried to run this ssh command, but it gives me the same 'command not found' error. It seems that the problem is with the ssh repo? The ssh repo has a git-annex-shell working and installed in PATH.