Reputation: 1
first off: I'm well aware that stackoverflow / the internet is full of similiar questions about this problem - but none had the answer to this specific one, even though I tried everything I could imagine in this case.
So, the problem is that I can't clone,pull,push,whatever to my remotely hosted repository on our Ubuntu server, when using git-bash or git.exe from my windows client. The exact error message is:
fatal: protocol error: bad line length character: pr_d
pr_developer is actually the user name, which I use for ssh login.
So the problem is that the server responds with the username in the beginning, instead of what should be the message size (I read that is what git expects). But a test with ssh git-receive-pack was successful!
image showing the problem
$ git clone [email protected]:/var/www/vhosts/xxxxxxxxxx/git/delphi/ c:/workspace/test1234
Cloning into 'c:/workspace/test1234'...
fatal: protocol error: bad line length character: pr_d
$ ssh [email protected] git-receive-pack /var/www/vhosts/xxxxxxxxxx/git/delphi/
00888c1bc7a0081e88bef034efb47ad6f7b14f3ce07e refs/heads/master report-status delete-refs side-band-64k quiet ofs-delta agent=git/1.9.1
0000Killed by signal 2.
The next thing I've tried is changing the shell of pr_developer. Neither /bin/bash nor /usr/bin/git-shell did solve it - the only difference is you can't login interactively with the git shell anymore.
The pr_developer user has no .bashrc that outputs something extra! When I log in with that user, it normally displays the "Welcome to Ubuntu"-Message, then leaves me with the cursor at pr_developer@servername:~$
Well that "Welcome to Ubuntu" obviously doesn't seem to bother git, but the outprint of the username does, am I right?
Kenster, actually brought me to the idea of disabling TTY for the user. I've tried this by adding the following lines to my sshd_config, restarting and trying to clone again
Match User pr_developer
PermitTTY no
Unfortunately, it didn't help!
Anyone knows what to do? Thanks and Regards
Upvotes: 0
Views: 1425
Reputation: 11
In my case, this behavior was caused by the GIT_SSH
environment variable. It was set to:
GIT_SSH=C:\Program Files\PuTTY\plink.exe
The solution was simply to delete the environment variable:
set GIT_SSH=
Upvotes: 1