Reputation: 95
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.
Upvotes: 8
Views: 8825
Reputation: 1
In my case, I had an
echo $HOSTNAME
in my .bashrc and .bash_profile that I was using to diagnose some connection problems. This gave me the message:
fatal: protocol error: bad line length character: [VSR
when I tried to git pull
from an ssh repo. Removing the echo
statements makes things work; the '[VSR
' is just the first 4 characters from the echo
.
Upvotes: 0
Reputation: 1
I had the same problem today at my job... so I found this: Setting up a Git Server on Windows Server 2008 R2
What you need to see is below:
Making Git work on the server:
If not already done, install msysgit on your server (I would recommend to install it directly to C:\Git or at least a path that has no spaces because I had some weird issues with “spaced” paths)
Add C:\Git\bin to the PATH variable. This is very important!! sh.exe and other dependencies are in this folder
Now go to C:\Git\bin and add the following two files
gup.sh grp.sh 4. Open gup.sh in your favorite editor and insert
C:/Git/libexec/git-core/git-upload-pack.exe $*
5. Open grp.sh and insertC:/Git/libexec/git-core/git-receive-pack.exe $* The $* essentially rips off the single quotes from the repository path argument, so a path that has spaces in it won’t work here either I guess
Basically we’re done now and all git operations from the client should work. For a clone you have to type
git clone -u 'sh gup.sh' ssh://username@server/path/to/myrepo.git
or a push would be
git push --exec 'sh grp.sh' ssh://username@server/path/to/myrepo.git
but that is not very elegant.Cleaning things up:
- At first we want to get rid of the whole repo path by specifying a remote alias
git remote add origin ssh://username@server/path/to/myrepo.git Where “origin” would be the alias name
- Next we set the config for the git-upload-pack and git-receive-pack so we don’t have to reference the shell script all the time.
git config remote.origin.uploadpack 'sh gup.sh'
and
git config remote.origin.receivepack 'sh grp.sh'
That’s it. Now we can use the normal git commands without any additional parameters:git clone origin git push origin master git pull origin ...
Upvotes: 0
Reputation: 56
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
Upvotes: 4