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:15

you can always have http link to your git project. You can use that instead of ssh link. This is just an option you have

查看更多
闭嘴吧你
3楼-- · 2019-01-01 16:17

The following may help someone: When trying to clone a project I have on my AWS EC2 instance I was getting the following error:

Cloning into 'AWSbareRepo'...
fatal: protocol error: bad line length character: Plea

This was caused by trying to ssh as root instead of EC2-USER. if you actually ssh without doing a git clone... you will see the error msg in something along the lines of "Please login with ec2-user" Once I did a git clone as a ec2-user it was good.

查看更多
春风洒进眼中
4楼-- · 2019-01-01 16:18

I had a similar problem on Windows using Git Bash. I kept getting this error when trying to do a git clone. The repository was on a Linux box with GitLab installed.

git clone git@servername:path/to/repo
fatal: protocol error: bad line length character: git@

I made sure the ssh key was generated. The public key was added on GitLab. The ssh-agent was running and the generated key was added (github link).

I ran out of options and then finally tried closing Git Bash and opening it again by right clicking 'Run as Administrator'. Worked after that.

查看更多
荒废的爱情
5楼-- · 2019-01-01 16:18

In my case the problem was 32-bit Putty and pageant.exe - it can't communicate with 64-bit TortoisePlink.exe. Replacing 32-bit Putty with a 64-bit version solved the problem.

查看更多
只靠听说
6楼-- · 2019-01-01 16:19

I had the same error "fatal: protocol error: bad line length character: shmi" Where the shmi is user name in my case. I switched SSH from PuTTY to OpenSSH in "Git Extensions->Settings->SSH". It helped.

查看更多
呛了眼睛熬了心
7楼-- · 2019-01-01 16:19

Well, I had this same issue (Windows 7). Try to get repo by password. I use Git Bash + Plink (environment variable GIT_SSH) + Pageant. Deleting GIT_SSH (temporary) helps me. I don't know why I can't use login by pass and login with RSA at the same time...

查看更多
登录 后发表回答