Git push results in fatal: protocol error: bad line length character: This
Another thing to check is that your .bashrc does not print extra stuff. For example 'echo "hello"' in .bashrc creates the error:
kruus@borg:~/malt$ ssh snake01
Last login: Tue Oct 21 10:44:31 2014 from 138.15.166.103
hello
...
kruus@snake01:/net/snake01/usr/hydra/kruus/malt$ git pull
fatal: protocol error: bad line length character: hell
Note how saying hello caused one hell of a problem.
Removing the 'echo "hello"' from my .bashrc allows git to work as expected again. You may need to ">& /dev/null" to remove output if your .bashrc does more complicated things.
If anyone else has this problem, the solution is to change the login shell of the user 'git' (or whatever your user is called) to /bin/bash
. This can be done via the command : usermod -s /bin/bash git
(Link). 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.
The solution to my issue with this was that I'd forgotten to add in a deploy key for the project (for the user I was trying to deploy as).
Adding a deploy key in https://gitlab/group/project/deploy_keys sorted me out.
Just for other users reference:
fatal: protocol error: bad line length character: no s
can be a truncated answer for "No such project".
As in my case, this kind of error can be fixed by adding user (even yourself) to the project in gitlab:
https://gitlab.com/username/your_project/project_members
also, ensure your public key is set in your user Profile settings > SSH Key or in Project > Settings > Deploy Keys
https://gitlab.com/profile/keys