Git Remote: Error: fatal: protocol error: bad line

2019-01-01 15:44发布

I set up a git server and want now to push initially my repo from the client. I used git push origin master and get this error message:

fatal: protocol error: bad line length character: Unab

I don't know what's wrong. I don't know what "Unab" is. I tried to resize the shell but it is still "Unab". I cannot find a solution for this error message.

I setup the server with "authorized_keys" and SSH. (I can connect to it, using SSH.)

It seems to be a git problem?

BTW: The server is set up in a Windows 7 VM

28条回答
与风俱净
2楼-- · 2019-01-01 16:20

Check if Shell access is allowed on the server.

查看更多
人气声优
3楼-- · 2019-01-01 16:21

I had similar issue, but the exact error message was:

fatal: protocol error: bad line length character: Usin

This is in Windows, with GIT_SSH set to the path of plink.exe of PuTTY.

Possible problems and solutions:

  • Make sure the path to plink.exe is correct. Unix style path works fine too, for example /c/work/tools/PuTTY/plink.exe
  • Make sure the key agent of PuTTY (pageant.exe) is running
  • Make sure the key agent contains a valid key to access the server
查看更多
其实,你不懂
4楼-- · 2019-01-01 16:22

I had the same problem as Christer Fernstrom. In my case it was a message I had put in my .bashrc that reminds me do do a backup when I haven't done one in a couple of days.

查看更多
柔情千种
5楼-- · 2019-01-01 16:22

i also encounter that error once in a while, but when it does, it means that my branch is not up-to-date so i have to do git pull origin <current_branch>

查看更多
素衣白纱
6楼-- · 2019-01-01 16:23

Maybe you have a statement in the server's .bashrc that produces output. I, for example had this:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
rvm use ruby-1.9.3-p194@rails32

In this case the output from the rvm use will be (wrongly) interpreted as coming from git. So replace it by:

rvm use ruby-1.9.3-p194@rails32 > /dev/null
查看更多
倾城一夜雪
7楼-- · 2019-01-01 16:24

Check your startup files on the account used to connect to the remote machine for "echo" statements. For the Bash shell these would be your .bashrc and .bash_profile etc. Edward Thomson is correct in his answer but a specific issue that I have experienced is when there is some boiler-plate printout upon login to a server via ssh. Git will get the first four bytes of that boiler-plate and raise this error. Now in this specific case I'm going to guess that "Unab" is actually the work "Unable..." which probably indicates that there is something else wrong on the Git host.

查看更多
登录 后发表回答