tags:

views:

1053

answers:

4

I am a newbie with git but seem to have a problem with pushing a git repository over a network.
Here is what I do to recreate the problem:

  1. create a new git repository on the computer to push to
    mkdir ~/git/test.git
    cd !$
    git --bare init-db

  2. On my local computer I then create a new git repository and add a random file to it:
    mkdir test
    git init
    touch TEST
    git add .
    git commit -m "initial commit"

  3. Then add the remote computer via:
    git remote add origin ssh://[email protected]/~/git/test.git

  4. Then I try to push the local repository to the remote via:
    git push origin master

This is what I get when I do that:

fatal: protocol error: bad line length character <---- sometimes this is not there
Access denied
Access denied
Access denied
Access denied
FATAL ERROR: Server sent disconnect message
type 2 (protocol error):
"Too many authentication failures for user"

I am using cygwin on an XP machine and trying to push to a unix server.

I have also tried it between my two computers I have at home and I have the same problem, both are windows machines by the way.

I have set up passwordless login via ssh and I can ssh no problem via:
ssh [email protected]

I've been trying to figure this out for two days now, any help would be appreciated

Thanks,
Aaron

A: 

I'm not sure about your access problems, but the path in

git remote add origin ssh://[email protected]/~/git/test.git

worries me. What do you get with

git remote add origin ssh://[email protected]/git/test.git

?

Also please show output from git push -v ...

Norman Ramsey
+1  A: 

The issue is probably that ~ won't expand correctly when using it in a ssh URI. You would need to specify the absolute path to the git repository on the remote machine in the ssh URI, like this:

ssh://[email protected]/home/user/git/test.git
oyvindio
A: 

Try to use

ssh://[email protected]:/home/user/git/test.git
Ikke
A: 

In your case the problem is probably the ~ character. Use:

  git remote add origin [email protected]/git/test.git

However, I've also seen this problem (always on Windows client machines) when the username ("user@") part was missing, so anyone else with this problem should check that too.

Thomas Leonard