首页 > 解决方案 > Git-receive-pack 致命

问题描述

我已经在 linux ssh 服务器后面设置了一个 git 存储库。存储库位于/home/git/mimpi.git. 用户 git 的登录 shell 是/usr/bin/git-shell pub/privssh 密钥,已在client/server侧面设置和测试。

现在我正在尝试使用 验证设置git-receive-pack,但它总是以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

我试图在 mimpi.git 周围加上单引号,但没有成功(https://github.com/dulwich/dulwich/issues/365

我试图运行strace -f sshd以跟随执行git-shell,但在之后没有发现任何有意义的东西:

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

和之前fatal: bad argument" ...

有任何想法吗?

标签: gitgit-shell

解决方案


git-shell做非常有限的取消引用。您应该只用单引号引用您的存储库:

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

我不确定您是否应该完全像这样使用 ssh 来执行此操作,但至少在本地运行 git shell 会以这种方式成功:

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

推荐阅读