Search code examples
gitgit-shell

Git-receive-pack fatal


I've setup a git repository behind linux ssh server. The repository is located at /home/git/mimpi.git. Login shell of user git is /usr/bin/git-shell pub/priv ssh keys have been setup and tested on client/server side.

Now I'm trying to validate the setup, using git-receive-pack, but it always fails with fatal: bad argument.

kalou@client:~$ ssh git@0 git-receive-pack mimpi.git
Enter passphrase for key '/home/kalou/.ssh/id_rsa':
fatal: bad argument

I tried to put single quotes around mimpi.git, with no success (https://github.com/dulwich/dulwich/issues/365)

I tried to run strace -f sshd to follow execution of git-shell, but did not find anything meaningfull after:

17882 execve("/usr/bin/git-shell", ["git-shell", "-c", "git-receive-pack /home/git/mimpi"...], [/* 9 vars */]) = 0

and before fatal: bad argument" ...

Any ideas?


Solution

  • git-shell does very limited unquoting. You should quote your repository only with single quotes:

    $ ssh git@0 "git-receive-pack 'mimpi.git'"
    

    I am not sure you should do it with ssh exactly like this, but at least running git shell locally succeeds this way:

    git shell -c "git-receive-pack '.'"
    ..lists references...