0

I have a windows PC trying to connect to gitlab via ssh. I have tested that the ssh connection works fine:

user MINGW32 /z/www/project (master)
$ ssh -T git@gitlab.foo.com
Welcome to GitLab, @user!

But pushing doesn't work:

user MINGW32 /z/www/project (master)
$ git push origin master
fatal: protocol error: bad line length character: git@
Access denied
Access denied
Access denied
Access denied
Access denied
FATAL ERROR: Server sent disconnect message
type 2 (protocol error):
"Too many authentication failures"

This is the origin set previously:

$ git remote add origin git@gitlab.foo.com:my-project/project.git
$ git remote --verbose: 
origin  git@gitlab.foo.com:my-project/project.git (fetch)
origin  git@gitlab.foo.com:my-project/project.git (push)

The errors looks like it's trying many keys and eventually failing, but I don't understand how ssh works then fine. Also in my .ssh folder i only have 1 key.

Additional troubleshooting:

ssh git@gitlab.foo.com git-receive-pack my-project/project.git
009a0000000000000000000000000000000000000000 capabilities^{}report-status delete-refs side-band-64k quiet atomic ofs-delta push-options agent=git/2.22.0
0000

ssh git@gitlab.foo.com /bin/true
> GitLab: Disallowed command

Anyone has any idea?

Thanks!

JoeSlav
  • 4,479
  • 4
  • 31
  • 50
  • Check this out: https://stackoverflow.com/questions/8170436/git-remote-error-fatal-protocol-error-bad-line-length-character-unab – He3lixxx Nov 12 '19 at 12:06
  • What is the output of `git remote --verbose`? – Eray Nov 12 '19 at 12:06
  • 1
    So what happens if you do `ssh git-receive-pack ` and `ssh /bin/true` as suggested in this question? – He3lixxx Nov 12 '19 at 12:13
  • @He3lixxx see above in question, all "ssh" commands seem to work but again, when I try to push, I get the above errors. – JoeSlav Nov 12 '19 at 13:01

1 Answers1

0

Got it!

This env variable was messing everything up: GIT_SSH=C:\Program Files\PuTTY\plink.exe Once we did unset GIT_SSH, it worked.

Credit to one of the comments of: https://stackoverflow.com/a/35913460/523173

JoeSlav
  • 4,479
  • 4
  • 31
  • 50