简体   繁体   English

无法推送到本地git repo

[英]Unable to push to local git repo

I am trying to create a git repo on localhost. 我想在localhost上创建一个git repo。 I followed the following tutorial: https://linuxprograms.wordpress.com/2010/05/10/how-to-set-up-a-git-repository-locally/ Everything works fine until I try to make the first push. 我按照以下教程: https//linuxprograms.wordpress.com/2010/05/10/how-to-set-up-a-git-repository-locally/一切正常,直到我尝试进行第一次推送。 I get the following error: 我收到以下错误:

fatal: protocol error: bad line length character: JAVA 致命:协议错误:行长字符错误:JAVA

Many questions similar to this, suggests that I should look for echo statements in .bashrc file. 许多与此类似的问题表明我应该在.bashrc文件中查找echo语句。 But there are no echo statements there. 但那里没有回声。 I get the same error when I try to push to a remote repo as well. 当我尝试推送到远程仓库时,我也遇到了同样的错误。

This is a common problem, namely the error: 这是一个常见的问题,即错误:

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.. 我已经读到,这可能是由于服务器上的Shell访问(是否允许访问?)问题引起的。

Perhaps this link would be of any help: Git Remote: Error: fatal: protocol error: bad line length character: Unab . 也许这个链接会有任何帮助: Git Remote:错误:致命:协议错误:坏行长度字符:Unab It seems related. 看起来很相关。

Goodluck! 祝好运! ;) ;)

You can try the following: 您可以尝试以下方法:

usermod -s /bin/bash git

Also, the following post might provide more information on this: ref 此外,以下帖子可能会提供更多相关信息: ref

Reason (Quoted from post): 原因(引自帖):

The reason for changing the login shell is because the default shell for the git user is /sbin/nologin (or similar, depending on environment), which prevents the git application from logging in as the git user on the git server. 更改登录shell的原因是因为git用户的默认shell是/ sbin / nologin(或类似,取决于环境),这会阻止git应用程序以git用户身份登录git服务器。

I've seen this a few time when run through TeamCity. 我通过TeamCity运行了几次。 In our case the /tmp space is full, clearing it removes the problem. 在我们的例子中,/ tmp空间已满,清除它会消除问题。

Unfortunately I can't explain why this causes the problem. 不幸的是,我无法解释为什么会导致这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM