D.R.
D.R.

Reputation: 21194

git commit on Windows shared network folder

I want to use a Hyper-V Windows Virtual Machine for development. In order to backup all my data I've "mounted" (mapped) a shared directory of the host OS into the virtual machine. I can edit files in this shared directory just fine.

However, git does not work properly. Whenever I try to commit something it tells me:

fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Invalid argument

What is the problem? Is this a known incompatibility?

git status seems to work just fine.

Upvotes: 2

Views: 302

Answers (2)

D.R.
D.R.

Reputation: 21194

If anyone runs into this, I've found a workaround. I've made the directory a local one in the VM and gave the host machine network access. So the host can reach it the other way round and I can backup the directory without the VM being backed up completely.

Upvotes: 1

torek
torek

Reputation: 488203

I can't say whether it is a known incompatibility, but this:

fatal: cannot update the ref 'HEAD':
unable to append to '.git/logs/HEAD': Invalid argument

strongly suggests that the particular file system setup you're using simply does not support open-for-append:

*fd = open(path, O_APPEND | O_WRONLY | O_CREAT, 0666);

or:

*logfd = open(logfile, O_APPEND | O_WRONLY, 0666);

from C code. Whichever of these two is being used—which one is used depends on whether the file .git/logs/HEAD already exists or not—the open system call is returning EINVAL.

As O_WRONLY and O_CREAT are supported in all file systems that allow any kind of file-writing at all, the problem has to lie with file system's implementation of the O_APPEND flag.

Upvotes: 2

Related Questions