gitlab-shell: Disallowed command

故事扮演 提交于 2019-12-20 01:06:12

问题


I've installed the recent version of GitLab on Ubuntu 14.04 and it works fine except pushing to the remote.

Running ssh git@example.com "git-receive-pack repo.git" works well. In ~/gitlab-shell/gitlab-shell.log, result is

INFO -- : gitlab-shell: executing git command git-receive-pack repo.git for user with key key-1.

But when I'm running git push, the log says:

WARN -- : gitlab-shell: Attempt to execute disallowed command git receive-pack 'repo.git' by user with key key-1.

And the output is:

fatal: protocol error: bad line length character: Disa

The output of ssh git@example.com "git receive-pack repo.git" is

"Disallowed command"

So the difference between allowed and disallowed is a missing dash.

My git versions:

  • Local git version: 2.2.1 (OS X)
  • Remote git version: 1.9.1 (Ubuntu 14.04)

How can I fix that? Is there a config param?


回答1:


I have been having the same problem, and editing ~/.gitconfig solved the problem.

Something, at some time in the past, had modified my local ~/.gitconfig file and inserted this entry:

[remote "origin"]
        receivepack = git receive-pack

I modified it to the following, and now everything works well.

[remote "origin"]
        receivepack = git-receive-pack



回答2:


I've spend a lot of time on this problem myself when I had the following returned:

fatal: protocol error: bad line length character: This

I've read that this can happen due to of problems with the Shell access (is the access allowed?) on the server..

It might be useful to look at Git push results in fatal: protocol error: bad line length character: This, which helped me back then.

I hope it's helpful in some way.. :)



来源:https://stackoverflow.com/questions/29588258/gitlab-shell-disallowed-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!