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.
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:
plink.exe
is correct. Unix style path works fine too, for example /c/work/tools/PuTTY/plink.exe
pageant.exe
) is runningFor GitExtension users:
I faced the same issue after upgrading git to 2.19.0
Solution:
Tools > Settings > Git Extensions > SSH
Select [OpenSSH] instead of [PuTTY]
I had the same kind of problem after installing GIT on Windows. At first it worked; then, a day later (after a PC reboot), it didn't anymore, and I got this:
$ git pull
fatal: protocol error: bad line length character: git@
The problem was that after the reboot, the automatically started Putty "pageant.exe" didn't have the private key active anymore. When you add a key in pageant, it's not a persistent setting by default. I just had to add the key again, and it worked fine. So, for that case, it's necessary to make pagenant load the key automatically, as discussed here:
https://www.digitalocean.com/community/tutorials/how-to-use-pageant-to-streamline-ssh-key-authentication-with-putty
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With