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

Changing the ssh exectuable from builtin to nativ under settings/version control/git did the trick for me.

查看更多
流年柔荑漫光年
3楼-- · 2019-01-01 16:07

In my case after fetch it was written: fatal: protocol error: bad line length character: Pass. Also after push I got: fatal: protocol error: bad line length character: git@ Done.

After reboot of Windows I had to start "PuTTY agent" (pageant.exe) again and add a private key that disappeared from a list of keys.

查看更多
伤终究还是伤i
4楼-- · 2019-01-01 16:08

After loading the SSH private key in Git Extensions, this issue gets resolved.

查看更多
骚的不知所云
5楼-- · 2019-01-01 16:08

It could be a security access on your machine, are you running Pageant (which is a putty agent)?

查看更多
梦寄多情
6楼-- · 2019-01-01 16:09

This error message is a bit obtuse, but what it's actually trying to tell you is that the remote server didn't reply with a proper git response. Ultimately, there was a problem on the server running the git-receive-pack process.

In the Git protocol, the first four bytes should be the line length. Instead, they were the characters Unab... which is probably the beginning an error message of some kind. (ie, it's probably "Unable to..." do something).

What happens when you run ssh <host> git-receive-pack <path-to-git-repository>? You should see the error message that your git client is barfing on and you may be able to correct it.

查看更多
无色无味的生活
7楼-- · 2019-01-01 16:10

The error transformed in: fatal: protocol error: bad line length character: fata

after adding the location of git-upload-pack to the system path.

The problem seem to be an apostrophe added around the repository name: Looking with a tool like Process Monitor (from sys internals), that were added by the git client. It seems to be a git specific windows problem.

I tried the same command line in the prompt of the server: the full error was "fatal: not a given repository (or any of the parent directories): .git"

In conclusion, to me it seems like a software bug. Be advised that I am not a git expert, it is first time I use git, i come from subversion and perforce.

查看更多
登录 后发表回答