I have set up a remote server repository using the git-annex web assistant, accessed via ssh. The repository is a bare one according to the config file in the annex directory on the server.
I am wondering how I could access any of the files in the repository while logged in to the server - they don't have their usual file names to look for clearly. Is there a way to get a list of the files for starters? I tried using git annex find, but it never returns any files. git annex get followed by a filename of a document in the repository also doesn't work.
Thanks to help me understand better how to approach this.
Do you have git-annex available on the server from the command line?
If so, the easiest way would probably be to clone the repo in git, and do a "git annex init" in it. This would give you a copy of the repo with none of the files in it. It would be tiny, just full of symlinks, no content. Then pull down copies of only the individual files you need using "git annex get."
Maybe set that repo to "untrusted" to make sure other repos don't start depending on it to store copies of files to fulfill numcopies.
When you're done with a copy of a file, just "git annex drop" it again so it disappears from this skeletal repo.
I have git-annex on the VPS. The bare repository is in the directory "annex"
From the user's root directory, I execute:
git clone annex/ Documents Cloning into 'Documents'... done. warning: remote HEAD refers to nonexistent ref, unable to checkout.
cd Documents/ ~/Documents$ git annex init 'Documents on VPS' init Documents on VPS ok (Recording state in git...)
Still, when I try to get a file now, or do a git annex find, nothing shows up.
Thanks for your help. Unfortunately that doesn't do the trick either:
git annex sync (merging origin/git-annex into git-annex...) (Recording state in git...) commit ok git-annex: no branch is checked out
After this, git annex find still yields no results.
OK, I'm going to guess the problem is there is no "master" branch in your cloned repository, because there is no "master" branch in a bare remote. (Not sure about this, just guessing.) Try "git branch" in your clone. If there is no "master" branch, that's the problem.
If that's true, the right thing to do would probably have been not to clone from it, but to create a fresh git repo and then set your bare repo as a remote.
You could try doing that -- create a fresh git repo, git annex init it, and then try something like "git remote add barerepo /path/to/bare/repo" and then "git annex sync" which should pull changes from the bare repo's 'synced/master' branch into your 'synced/master' branch and from there into your master branch, giving you all your symlinks.
If that works you could declare your previous attempt "dead" and you'll be good.
It may also be possible to just fix the clone you've got by creating a master branch, maybe by branching off of synced/master. Do a "git branch" and see whether synced/master exists, and just try "git branch master synced/master" and then "git checkout master" and that might do the job!
But I'm just throwing ideas around here, so I hope somebody who actually knows what's going on (joey? are you there?) will pipe up.
So what does show up? Is your repo an empty directory? Or are the symlinks that should point to content there?
as far as git goes, are you on the master branch? is there a master branch? If you do "git status" what do you see?
There's no reason this shouldn't work for you....
I get the following:
frederik@niihau:~/Documents$ git status
On branch master
#
Initial commit
# nothing to commit (create/copy files and use "git add" to track)
And this is the config:
frederik@niihau:~/Documents$ cat .git/config [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/:refs/remotes/origin/ url = /home/frederik/annex annex-uuid = 1648a298-27aa-4cb1-xx-xxx [annex] uuid = 4406bd35-9ff7-4008-yy-yyy version = 3 [remote "niihau"] url = /home/frederik/annex fetch = +refs/heads/:refs/remotes/niihau/ annex-uuid = 1648a298-27aa-4cb1-xx-xxx
Not having worked with git before, all this is still very new for me. I have 33M of data in the .git directory, mostly in objects, so it does seem to have synced something already.
I'm not sure what's up. I hope Joey can weigh in.
"git annex sync" ought to go get the symlinks from your remote, and merge them into your master branch, which is currently checked out, so you should see them.
When the assistant (or git annex sync) pushes to a repository, it creates a
synced/master
branch. So your bare repository has no regularmaster
branch. So when you clone it, you get a repository with no branch checked out, which is what git-annex sync complains about.There are several solutions. The easiest is to run
git merge origin/synced/master
; then your checkout will have a master branch and you can usegit annex sync
from then on.git annex sync
to a bare repository does push to the regular branch. Sogit clone
will work without this bother.