git push返回“致命的:协议错误:坏行长度字符” [英] git push returns "fatal: protocol error: bad line length character"

查看:411
本文介绍了git push返回“致命的:协议错误:坏行长度字符”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我拥有的共享主机帐户上设置了远程Git存储库。为了允许另一个开发人员推/拉,我将他的公钥(id_rsa.pub)添加到共享主机上的.ssh / authorized_keys的末尾。然后,他能够做混帐推。但是我想确保他不能在我的共享主机上做任何事情,但是访问git,所以我将它添加到了authorized_keys中的条目的开头,根据 man authorized_keys

  command =/ usr / bin / git,no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa ... 

现在,当他执行git-push时,它会在命令行中响应致命的:协议错误:坏行长度字符。

我搜索了Google,发现其他人有这个问题,但找不到一个足够的答案来解决这个问题,而不允许其他用户访问我的共享主机帐户上的shell。

解决方案

您需要限制其他开发人员的密钥才能运行 git-shel

 command =/ usr / bin / git-shell -c \$ { SSH_ORIGINAL_COMMAND: - } \,no-port -... 


I set up a remote Git repository on a shared host account I own. To allow another developer to push/pull, I added his public key (id_rsa.pub) to the end of .ssh/authorized_keys on the shared host. Then he was able to do "git push". But I want to make sure that he cannot do anything else on my shared host but access git, so I added this to the beginning of his entry in authorized_keys, according to man authorized_keys:

command="/usr/bin/git",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa ...

Now when he does git-push, it responds on the command-line with "fatal: protocol error: bad line length character".

I've searched with Google, and found others having this problem, but could not find an adequate answer as to how to solve this without allowing this other user to have access to a shell on my shared host account.

解决方案

You need to limit the other developer's key to running git-shell as in

command="/usr/bin/git-shell -c \"${SSH_ORIGINAL_COMMAND:-}\"",no-port-...

这篇关于git push返回“致命的:协议错误:坏行长度字符”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆