git clone over ssh from remote repository:fatal: protocol error: bad line length character: fata

StackOverflow https://stackoverflow.com/questions/17296348

  •  01-06-2022
  •  | 
  •  

Question

I have set up a git server on Windows 8 box with following

  • msysgit (on both client and server)
  • FreeSSHd ( on server)

While git installation

  • on server(windows 8) i chose the insstallation directory to be d:\Experiments\Git
  • on client(windows 7) I chose it was default i.e ProgramFiles(x86)

Have setup proper public and private key and copied perivate key from server to client machine

i could SSH into my server using ssh command

$ ssh UserOne@192.168.1.4
Enter passphrase for key '/c/Users/UserOne/.ssh/id_rsa':
UserOne@192.168.1.4's password:

and the result after above is

Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Gaurav\Desktop>

BUT when i try to git clone my remote repository i get error...following is the command that i execute and also the result after execution

$ git clone ssh://UserOne@192.168.1.4/d/Experiments/repo/CenRepo /d/Experiments/Playground/New
Cloning into 'd:/Experiments/Playground/New'...
Enter passphrase for key '/c/Users/UserOne/.ssh/id_rsa':
UserOne@192.168.1.4's password:
fatal: protocol error: bad line length character: fata

I saw on some article to execute git-receive-pack, which actually outputs the error if there is any path issue ..but it ran fine ..following is the command and its result.

$ ssh UserOne@192.168.1.4 git-receive-pack d:/Experiments/repo/CenRepo
Enter passphrase for key '/c/Users/UserOne/.ssh/id_rsa':
UserOne@192.168.1.4's password:
00900000000000000000000000000000000000000000 capabilities^{}  report-status delete-refs side-band-64k quiet ofs-delta agent=git/1.8.3.msysgit.00000

Please note i put in "d:/Experiments/repo/CenRepo" rather than "/d/Experiments/repo/CenRepo"

I cant write "d:/Experiments/repo/CenRepo" in the git clone command

i am a newbie to git so not much idea about it. Thanks

Was it helpful?

Solution

fatal: protocol error: bad line length character: fat

See this FAQ:

It likely means you have some extraneous characters, info message or something upon logging into ssh in command mode.

To test this, do:

 ssh user@git.example.com echo testing commands

(in your case:)

ssh UserOne@192.168.1.4 echo testing commands

You should only see 'testing commands' returned.
If there are any other characters, you should examine your dot shell rc file to find any echo or other commands that may produce output.

In the case of FreeSSHd, you should check if it can execute a command without returning any extra output.

This answer suggests that it might not be possible to configured FreeSSHd in order to be "quiet" (execute and return the output of the commands you want, without extra data).
It suggests alternative ssh daemons.

OTHER TIPS

Problem is that,

If you change your ~/username/.bashrc .. or ANY bash file content, remove all echos and another string outputs, after try to connect again via git, it will be okey.

when you login over ssh if the remote server or local server (you can use git over local) printing to shell screen extra output. This is problem for git.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top