Please describe the problem.

I have created a git-annex via Windows. If I use sshfs to mount this onto a Linux server, and then setup a new remote, I encounter the error:

fatal: cannot run hooks/post-receive: No such file or directory

I've already identified that, due to the Windows created repository, the script uses crlf line-endings. And of course, the Linux kernel interprets the carriage-return as a trailing component of the shebang


and obviously can't find the executable.

I've already worked around this by using a binfmt_misc approach workaround, registering the shebang with ^M to trigger a wrapper script. But I'm seeking the permanent fix of git-annex creating these hooks with unix line-endings only. I think it's fair to say, there's currently no approach that allows hooks to be in any other form than unix scripts, and I'm happy to stand corrected, that it makes little sense to have any other line-endings.

What steps will reproduce the problem?

Run git annex sync against a Windows created remote git-annex, however that is mounted, on a Linux/unix host.

What version of git-annex are you using? On what operating system?

$ git annex version
git-annex version: 8.20210223

on a Debian bullseye operating system.

Please provide any additional information below.

$ git annex sync
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

It took 3.28 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
nothing to commit, working tree clean
pull origin
push origin
fatal: cannot run hooks/post-receive: No such file or directory
To /var/tmp/mnt/winhost-w10-5920/cygdrive/e/my.gitannex/
   a0ebd1826d..15cfd91da4  git-annex -> synced/git-annex

Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)

Yes. I think git-annex is a hidden gem of the open source community.