3

I was using SourceTree + Git on Windows without any problem. I was able to use git commands from command (terminal/BASH). I prefer to use terminal for git push/pull etc. Unfortunately, after reinstallation of my machine (server/git are the same), I'm getting this painful error.

On a new machine, I installed Git 1.9.5 (Git-1.9.5-preview20141217.exe) and configured to use BASH only and plink with proper SSH key file.

I can do git log on my repository, but git pull or git push gives this error:

me@NEW-MACHINE /c/Workspace/project (master)
$ git pull
fatal: protocol error: bad line length character:
@-

ERROR: Problem parsing the command line arguments.

Of course, I searched many articles related to "fatal: protocol error: bad line length character". But, couldn't find any clue.

Interestingly, on SourceTree, I can do git pull or push successfully. I'm only getting this error in BASH terminal. Note that SourceTree doesn't use embedded git.

Here are my investigations so far:

  • I installed an older version of git (1.8.x), still getting error.
  • Moved .bashrc, but no good.
  • Obviously, not a problem of SourceTree as SourceTree doesn't use embedded Git.
  • The server is in Github (enterprise, private).
  • I have no problem using any git commands on my Linux with the same git repository/server.

My clue is <newline>@-<newline> from the error message. It is more like a problem of Windows/BASH-specific problem. I can't figure it out what causes "@-".

Edit: I tried suggestions in this thread, but didn't solve my problem. The git server is github.mycompany.com, which doesn't allow any ssh connection.

Community
  • 1
  • 1
Nullptr
  • 3,103
  • 4
  • 27
  • 28

2 Answers2

1

You can circumvent the bash-ssh issue entirely by:

  • launching a DOS shell with git-cmd.bat (packaged within your Git for Windows msysgit distribution)
  • using git clone to make a new clone using the proper https url of your remote repo.

That is:

git clone https://<yourAccount>@github.mycompany.com/<yourAccount>/<yourRepo>

Since you will be using in this case the https protocol, there won't be any shell session during a git pull (as opposed to the ssh protocol: see The Smart Protocols), and you shouldn't see any extra message like fatal: protocol error: bad line length character.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

I had same issue for git in windows. Load your public/private key by Pageant App (Putty Authentication Agent). add private/public key.

dityagow
  • 69
  • 12