It seems I can't initialize git annex:

$ git annex init "files2"
init files2 
  pre-commit hook (/Volumes/project/annex/.git/hooks/pre-commit) already exists, not configuring

git-annex: waitToSetLock: failed (Operation not supported)
failed
git-annex: init: 1 failed
$

project is a remote file server connected via smb://.

Any ideas why and how to fix?

The smb:// is a red flag to me. git-annex relies on POSIX file locking, and I'll bet smb does not provide that, or, perhaps, your samba server needs a configuration change to support it.

You might consider putting your git annex repository on the local filesystem, and setting up a special remote on smb. The directory special remote is a likely choice.

Comment by http://joeyh.name/ Tue Oct 16 02:52:26 2012

Thanks for getting back so quick; So, after doing

git annex initremote smb type=directory directory=/Volumes/subproject/ encryption=none
git annex describe smb "smb://XXXhost.com/subproject"

What else do i need to do? Do i need to git init and/or git annex init in /Volumes/subproject/?

Nope, you're set with just those two commands. You can now do things like "git annex copy --to smb" to put files there, and "git annex get" will get files from there as necessary.

Comment by http://joeyh.name/ Tue Oct 16 04:12:55 2012
Could i use (some variant of) git annex sync to do two-way sync between local and smb?

git annex sync only syncs the git repository, not file contents, and the special remote has no git repo, only file contents. git annex copy will avoid transferring things that are already there, so it's the way to go.

If you want automatic syncing of file contents and lots of other magic including automatic commit of new files, you could try the assistant.

Comment by http://joeyh.name/ Tue Oct 16 04:23:59 2012

OK; The reason i ask about git annex sync is because I had previously copied the large files onto smb:// before setting up the annex and don't want to unnecessarily transfer large data over Internet again. But now if i do git annex copy --to smb, and check what's added/changed in smb end, i found

$ cd /Volumes/subproject
$ ls
091     383     bigdir1    bigfile1  ...

The files with numbers in names such as091, 383 are being added, the bigfile1 and bigdir1 are the ones previously copied there. What are those 091, 383 etc.

That's where it stores files in the directory special remote. You can move the similar contents of /Volumes/subproject/.git/annex/objects/ to the same place as those and then run git annex fsck --from smb --fast and it'll learn about those files you already transferred.

You probably also want to delete /Volumes/subproject/.git afterwards, and any git working tree that was checked out there before; the directory special remote does not use the git repository that you had there before.

Comment by http://joeyh.name/ Tue Oct 16 04:52:12 2012
Oh, I see. But what I need on the remote partition /Volumes/subproject connected via smb:// is the actual bigdir1 and bigfile, not the encoded objects. Maybe I should use some other types of special remote?
Maybe i didn't explain clearly at the beginning: /Volumes/subproject is a remote partition connected via smb://. It doesn't have a .git. The content I mentioned previously "copied" there was copied via cp -R. And my local annex is ~/project/subproject and it does have .git and .git/annex in it.

If you need a git repository with your regular file names on the smb share, none of the special remotes will meet your needs. You'd need to find a way to make it support POSIX locking to use git-annex on it in a full git repository.

But I think that in most cases a directory special remote on such a share, with the git repository kept locally and git-annex used to pull files down to it as needed, would work ok.

Comment by http://joeyh.name/ Tue Oct 16 05:52:08 2012
OK; The purpose of putting files on the remote smb:// partition is to publish these big data files, so other (potentially non-technical) people can download and use them. They'll not be willing to learn how to use git, let alone git-annex. And i have multiple development machines that can generate revisions/updates to these big files. I previously just rsync from/to various development machines to/from this smb partition, but i find sometimes I don't always srync in correct direction. The hope is i can have annex on these development machines, and set the smb:// partition as the remote for these git annex. But it sounds like none of the special remote will have the original form, and a normal remote is not possible on smb:// partition.
Comments on this page are closed.