我已经在 Ubuntu 14.04 上安装了最新版本的 GitLab,除了推送到远程外,它工作正常。
运行 ssh git@example.com "git-receive-pack repo.git"
运行良好。在 ~/gitlab-shell/gitlab-shell.log 中,结果是
INFO -- : gitlab-shell: executing git command git-receive-pack repo.git for user with key key-1.
但是当我运行 git push
时,日志显示:
WARN -- : gitlab-shell: Attempt to execute disallowed command git receive-pack 'repo.git' by user with key key-1.
输出是:
fatal: protocol error: bad line length character: Disa
ssh git@example.com "git receive-pack repo.git"
的输出是
"Disallowed command"
所以允许和不允许之间的区别是缺少破折号。
我的 git 版本:
- 本地 git 版本:2.2.1 (OS X)
- 远程 git 版本:1.9.1 (Ubuntu 14.04)
我该如何解决?有配置参数吗?
最佳答案
我一直遇到同样的问题,编辑 ~/.gitconfig 解决了这个问题。
在过去的某个时间,某些东西修改了我的本地 ~/.gitconfig 文件并插入了这个条目:
[remote "origin"]
receivepack = git receive-pack
我修改成如下,现在一切正常。
[remote "origin"]
receivepack = git-receive-pack
关于gitlab-shell : Disallowed command,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29588258/