Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: protocol error: bad line length character: Unab

I have a Windows 2008 R2 Server Standard Edition. I have FreeSSHd installed along with Git. Windows firewall has exceptions set to port 22. I have the SSH server setup to accept only SSH public keys. I can login to the server fine using terminal (i.e. ssh gregory@hostname). When I go to use the git clone command (e.g. git clone ssh://gregory@hostname/path_to_my_repo) I get this error:

fatal: protocol error: bad line length character: Unab

I am at an absolute loss as to what's causing it. I have Shell, SFTP and Tunnel protocols enabled.

like image 399
gwrichard Avatar asked Mar 12 '12 03:03

gwrichard


2 Answers

Forget freeSSHd. It cannot be configured to run with git.

You have two (as far as I could find) choices - go with a more sophisticated SSH server for Windows and then implement this: http://holyhoehle.wordpress.com/2011/01/26/setting-up-a-git-server-on-windows-server-2008-r2-using-msysgit-and-winsshd/

or go with OpenSSH (CopSSH)

http://java2cs2.blogspot.de/2010/03/setup-git-server-on-windows-machine.html

http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/

Setup a Git server with msysgit on Windows

http://code.google.com/p/tortoisegit/wiki/HOWTO_CentralServerWindowsXP

like image 76
Jimmytaker Avatar answered Nov 05 '22 05:11

Jimmytaker


Git over SSH uses the output of the SSH pipe verbatim. If that output contains any spurious data not related to git, then the git command fails to parse that and aborts with an obscure error message. That can happen if you have a user script that displays stuff when you connect, for instance, or if something throws an error message not understood by git.

You'll note that 'Unab' looks like the beginning of 'Unable', presumably an error message meant for a human being, not git, indeed.

What happens when you run the following command?

ssh gregory@hostname git-upload-pack '/path_to_your_repo'

In theory you should get an error message starting with 'Unable'. For instance, 'Unable to find git-upload-pack'. In which case the fix will be to add git-upload-pack to your path!

like image 45
Balinares Avatar answered Nov 05 '22 05:11

Balinares