28

So I thought I had finally got everything setup on Windows ... then ran into this issue.

Current setup

URL: ssh://user@host:port/myapp.git

Already run Putty - and can connect using valid .ppk keys through the ~/.ssh/authorized_keys direct. In Git and TortoiseGIT - I set both to use "plink.exe".

Putty works fine - no issues - but when I run that URL into bash I get for a git clone (url)

fatal: the remote end hung up expectedly

In a cygwin bash terminal - running "ssh user@host" - works no probs at all.

Anyone suggest anything?

David Segonds
  • 83,345
  • 10
  • 45
  • 66
  • 2
    Stick a -v into your git clone command to get more information - there might be a useful tidbit in there. – Daniel Yankowsky Sep 29 '09 at 16:40
  • hey i get a "connection refused" which tells me its something to do with the SSH keys but they both match up ? –  Sep 29 '09 at 16:48
  • it seems like it cant find the ".ppk" key - not sure how to fix this ? –  Sep 29 '09 at 17:00
  • 2
    Use pageant to pre-load your private key so git can use it when it tries to connect. – innaM Sep 29 '09 at 17:15
  • hey thanks yeah i have tried that and i get "the remote end hung up unexpectedly" –  Sep 29 '09 at 17:19
  • I have had trouble with Cygwin or Msysgit's Git command using protocols other than http:// (e.g. git://, ssh://), but http(s) works fine with GitHub.com – ewall Sep 29 '09 at 18:28
  • From you commments above, I get the impression that what your question says simply isn't true. It seems to me that you are **not** able to ssh to that host from git's shell only from cygwin. – innaM Sep 29 '09 at 19:23
  • hi yes sorry this is what i mean - i can access from cygwin but not from git. –  Sep 29 '09 at 19:30
  • 2
    This isn't actually a programming question. – David Thornley Dec 23 '09 at 17:13
  • possible duplicate of [github: newbie problems -> Permission denied (publickey). fatal: The remote end hung up unexpectedly](http://stackoverflow.com/questions/3617113/github-newbie-problems-permission-denied-publickey-fatal-the-remote-end) – ripper234 Nov 21 '11 at 14:15
  • Oops, I meant to close another question. I can't undo a close request, right? – ripper234 Nov 21 '11 at 14:16

11 Answers11

16

I found out that using ssh.exe from the Git package works every time, as opposed to the ssh that comes with cygwin (the default). Using this exported variable seems to help; it's slower (2x or more) but it's more stable. Take it as another workaround.

$ export GIT_SSH=/cygdrive/c/Program\ Files/Git/bin/ssh.exe

FYI: This version of Msysgit comes with OpenSSH 4.6p1, OpenSSL 0.9.8e. [works] Cygwin's SSH is OpenSSH 5.5p1, OpenSSL 0.9.8n. [doesn't work]

Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
PatC
  • 161
  • 1
  • 3
6

I had the same problem with plink for git under windows.

On run of plink.exe -v xxx@host.com it started to show Pageant is running. Requesting keys. Pageant has 1 SSH-2 keys login as: <<< trouble

Instead of Pageant is running. Requesting keys. Pageant has 1 SSH-2 keys Using user "xxx"

To resolve this problem I cleaned up the putty registry records and sessions by putty.exe -cleanup

After that plink starts afresh and asks to trust and store the host again and it is getting connected with no problem !

Alex Sh.
  • 61
  • 1
  • 1
  • 2
    The putty -cleanup fixed this problem I was having too (specifically in getting TortoiseGit to talk to GitHub.) Unfortunately it does blow away all your putty configs, so use with caution! – Eric Caron Nov 12 '11 at 05:35
2

Try following steps, maybe something will give you a hint on your problem:
1. Run putty and after setting up server name/user name/keys etc. save those settings.
2. Run plink.exe or plinkw.exe like plink.exe user_name@server, (it'll throw some info at you) just to see if plink can connect to the server.
3. Check again that git knows that it should use plink, I'd say with all VCSs, that's the problem people have most often, apart from their keys not being set up properly.
Normally by now most of your ssh problems would be revealed. Now just fix them. :)

Update:

I think the problem you have is caused by several gits you've got installed. For the msysgit and cygwin git you'd need to set the GIT_SSH variable. That's done via either 'set GIT_SSH=c:\path\putty\plink.exe' or 'export GIT_SSH=/your/path/putty/putty.exe' respectively. If you're also using tortoise git, you'd need to locate 'properties' (or is it settings?) in it's menu, and set the ssh client there.
Apart from all that, when specifying git clone URL, use your login name and the server name in there, e.g. 'git clone ssh://user@server/your/path/repo.git User and server names should be used by plink, and plink should be able to connect to the server with those arguments, when all of those requirements are met, you'll be all set.

Good luck.

Dmitry
  • 6,590
  • 2
  • 26
  • 19
  • hi - thanks for the response. how to check if git knows that it should be using plink ? –  Sep 30 '09 at 05:14
  • btw - ok did echo $SSH_GIT and got the relevant correct path. i also tried plink -P portnumber user@host -i /path/to/key/ and this connected successfully - its just git that aint working. –  Sep 30 '09 at 05:17
  • How about if you try setting GIT_SSH instead of SSH_GIT. – Dmitry Sep 30 '09 at 05:33
  • hi sorry yeah it was set to this. i just cant figure this out - i can connect via putty and plink (command line) but not GIT. everytime i attempt to clone the repo i get "failed hung up unexpectedly" –  Sep 30 '09 at 06:17
  • is there anyway to log what is happening when i attempt to clone via GIT ? i.e. someway to see what plink.exe is doing or ? –  Sep 30 '09 at 06:21
  • please check the update in the answer, it didn't fit in comment field. – Dmitry Sep 30 '09 at 14:55
1

If you want to try the cygwin openssh 5.4p1-1, which does seem to work for this, unlike 5.5 or 5.6, you can use the cygwin time machine mirrors. Start setup.exe with -X and add a mirror Url, such as:

ftp://www.fruitbat.org/pub/cygwin/circa/2010/05/20/230133

Be careful not to install too much, i.e. base packages, from an older mirror than the rest of your install.

eisd
  • 11
  • 1
1

We had same problem and here is solution how we solved the problem:

at first we got:

zajdan@cyberFuture:~$ git clone ssh://nette@19X.16X.14X.7X/~repos/erotika.git/ erotika
Initialized empty Git repository in /home/zajdan/erotika/.git/
Password: 
fatal: '/repos/erotika.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
zajdan@cyberFuture:~$ 

solution:

zajdan@cyberFuture:~$ git clone ssh://nette@19X.16X.14X.7X/~/repos/erotika.git/ erotika

after tilde there must be a slash!

Zsolt Botykai
  • 50,406
  • 14
  • 85
  • 110
ZAJDAN
  • 121
  • 1
  • 1
  • 5
0

I have exactly the same issue.

I don't use Putty (just Cygwin). I use Windows 7 Ultimate (fully patched as of this moment). I just installed Cygwin yesterday.

I made sure binary mounts were being used.

If I copy a git repo to the machine (via samba mount), I can clone it, but when I "git diff" after the clone, there are a bunch of "different" files with no diffs. After a "git status" there was no output from "git diff". It seems like a newline thing, but I can't figure out how that would be happening. (I have igncr in SHELLOPTS, but removing that doesn't fix it.)

I'm completely stumped.

e40
  • 397
  • 1
  • 11
  • Btw, ssh to the git host produces no extraneous output. – e40 Dec 23 '09 at 17:06
  • I think this is a Cygwin 1.7.1 issue. I just upgraded a machine running Cygwin 1.5 to 1.7.1 and a working git there now fails in the same way. I have posted something to cygwin@cygwin.com, and will report back here if there is a resolution. – e40 Dec 23 '09 at 18:57
  • 2
    It's a problem with the Cygwin openssh. If you use Putty's plink.exe, you can workaround the issue: http://www.cygwin.com/ml/cygwin/2009-12/msg01147.html – e40 Jan 06 '10 at 19:20
0

Check the openssh version you're using in CygWin. Version 5.5p1-1 (which is the latest at this time) gave me the same error. Downgrading to 5.4p1-1 fixed the problem.

Another solution would be to use putty/plink instead of openssh.

For more details, see this thread: http://www.mail-archive.com/cygwin@cygwin.com/msg103752.html

Gabriel Burca
  • 196
  • 1
  • 2
0

I get message: "remote end gung-up, unexpected EOFs, index-pack failed" while cloning git repo but was able to workaround this issue with copssh http://sourceforge.net/projects/sereds/files/Copssh

The root cause is Cygwin openssh package.

I removed original openssh from Cygwin, installed copssh and set GIT_SSH variable to point copssh binaries. After this I simply added copssh binaries in the PATH and now I'm using copssh instead of openssh - there is no difference.

Everything works fine and issue does not appear any more.

The other solution is to use mSysGit package.

0

I believe the real problem is that cygwin's ssh looks for .ssh in /home/name/.ssh and mingw's git ssh looks for .ssh in c:/user/name/.ssh

Chances are your keys are in one and only one of these directories.

You can trying telling cygwin's .ssh to use a different identity file using the -i switch, or move the keys into both directories, or create an ssh config file in /home/name/.ssh/config.

I created a config that contains:

Host github.com
    User jerryasher
    Hostname github.com
    IdentityFile c:/Users/jerry/.ssh/id_rsa

And given that I can use either the mingw git from git bash or cygwin's git from an rxvt to interact with github.

Jerry Asher
  • 836
  • 2
  • 10
  • 23
0

To correct this issue, run "plink -agent github.com" Press y when prompted to cache the key. Login as git. You'll automatically be disconnected. And it sould work.

Source: http://devlicio.us/blogs/sergio_pereira/archive/2009/05/06/git-ssh-putty-github-unfuddle-the-kitchen-sink.aspx

octane097
  • 11
  • 2
0

Try to use absolute path to repo in a URL, that worked for me.

Instead of:

git ssh://user@host:port/myapp.git

Write:

git ssh://user@host:port//home/user/repo/myapp.git

Notice the double slash!

Kangur
  • 7,823
  • 3
  • 30
  • 32