1

I'm attempting to push to a repository over SSH instead of the normal https or whatever the default is. This process requires a username and password instead of an ssh key. However this always fails when I try to do this:

Owner@DESKTOP /w/programming/wreckcreations-site/dev (dev)
$ git push -vvv --all ssh://*name*@*site*/~/html/dev2
Pushing to ssh://*name*@*site*/~/html/dev2
fatal: The remote end hung up unexpectedly

Thinking it was an SSH issue, I tried to SSH into my local server

Owner@DESKTOP /w/programming/wreckcreations-site/dev (dev)
$ "`echo $GIT_SSH`" 192.168.2.2
login as: root
root@192.168.2.2's password:
Last login: Thu Nov 18 19:36:58 2010 from 192.168.2.4
←]0;root@system:~[root@system ~]# exit
logout
←[H←[2J
Owner@DESKTOP /w/programming/wreckcreations-site/dev (dev)
$ git push -vvv --all ssh://root@192.168.2.2/~/somedir
Pushing to ssh://root@192.168.2.2/~/somedir
fatal: The remote end hung up unexpectedly

Same error message... So I looked in /var/log/secure on the box

Nov 18 21:15:06 system sshd[28460]: Accepted password for root from 192.168.2.4 port 2788 ssh2
Nov 18 21:15:06 system sshd[28460]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 18 21:15:11 system sshd[28460]: pam_unix(sshd:session): session closed for user root
Nov 18 21:17:35 system sshd[28618]: Received disconnect from 192.168.2.4: 13: Unable to authenticate

The first three lines are from plink, the last one is from git. The last line can be repeated every time I try to use git push. Which makes no sense

If I assume that my remote host is getting the same error message, why isn't git submitting my username and just disconnecting? I've never seen this kind of error before, so I'm really confused.

It should be noted that this is a Windows XP box using msysgit with both remote servers being Linux.

Any suggestions?

TheLQ
  • 14,830
  • 14
  • 69
  • 107
  • `ssh://*name*@*site*/~/html/dev2` appears not to include a password... – Armand Nov 19 '10 at 04:27
  • @Alison `ssh://*name*:*pass*@*site*` didn't work either. From a site or two that I saw where someone got it working, it asked for a password. – TheLQ Nov 19 '10 at 12:41

2 Answers2

1

To use plink with git, you must do private key authentication. See this or this for instructions.

J-16 SDiZ
  • 26,473
  • 4
  • 65
  • 84
  • While private key authentication would fix my problem, this isn't my server and I can't use that kind of auth. Its strictly username and password. – TheLQ Nov 19 '10 at 12:40
  • alternativaly, use openssh from cygwin. git just don't work with plink. – J-16 SDiZ Nov 20 '10 at 13:23
1

Apparently Plink just doesn't work this way with git, so I switched back to ssh. After many days of pain trying to get ssh and git to just work in Windows (hit the infamous "Unprotected key file!" error, ssh process randomly hanging, non-standard (and not working) private and public keys generated by Putty, multiple reinstalls, dragging of cygwin binaries and DLL files into git, etc), I successfully pushed to the remote server.

I would highly recommend not attempting this if your on Windows, as the process is just too time consuming and frustrating. I am myself seeking alternative solutions so I don't have to do this all over again when I do a reformat or move to a new computer.

Community
  • 1
  • 1
TheLQ
  • 14,830
  • 14
  • 69
  • 107
  • You are absolutely correct. I hit the same horror story: http://stackoverflow.com/questions/6681918/git-push-using-putty-on-windows-fails-fatal-the-remote-end-hung-up-unexpectedly Still no end in sight... – WinWin Jul 14 '11 at 18:45
  • @WinWin Honestly after this and other nonsense I switched to Mercurial a few months later. See here: http://programmers.stackexchange.com/questions/87217/why-is-mercurial-considered-to-be-easier-than-git/87245#87245 – TheLQ Jul 14 '11 at 19:09