7

I was able to 'git clone a repository using git clone in my MS Terminal (the one start by using cmd).

git clone git+ssh://[email protected]/~/Src/Test

But when I do the SAME command under Cygwin, it just hangs. I have checked they are using the same instance of Git so my question is why it does not work under Cygwin?

8
  • Just guessing here, but it probably has to do with the ssh key. Make sure that a) you have a public key in your $CYGHOME/.ssh and b) that your server is aware of that key.
    – swasheck
    Apr 12, 2012 at 20:47
  • I open cygwin terminal and then cd to '~' I assume it is the $CYGHOME. There is a '.ssh' directory, but it is empty. how can I create a public key to access my other machine?
    – michael
    Apr 12, 2012 at 21:07
  • 1
    @michael: See section "Tunneling" on this page.
    – Bora
    Apr 12, 2012 at 21:21
  • ssh-keygen -t rsa OR ssh-keygen -t dsa
    – swasheck
    Apr 12, 2012 at 21:21
  • I did this, but it just hangs as well $ ssh-keygen -t rsa Enter file in which to save the key (/c/Programs/cygwin/home/michael/.ssh/id_rsa): id_rsa
    – michael
    Apr 12, 2012 at 22:13

4 Answers 4

9

The problem is when you don't install Git on Cygwin and Cygwin uses your official installation of Git on your Windows machine. So, when you try any action that requires connection to an external repository (push, pull, clone) it just hangs. In my case I already had installed Git on my machine, so when I checked on Cygwin if Git was present using 'git --version' Git respond.

You need to run Cygwin installer again and install Git package.

Hope this helps someone.

1

This has always worked well for me

$ ssh-keygen -t rsa -C [email protected]
Generating public/private rsa key pair.
Enter file in which to save the key (/home/Steven/.ssh/id_rsa):
Created directory '/home/Steven/.ssh'.

Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Your identification has been saved in /home/Steven/.ssh/id_rsa.
Your public key has been saved in /home/Steven/.ssh/id_rsa.pub.
The key fingerprint is:
e2:83:fc:1c:62:b6:33:ec:69:80:86:f9:1a:5d:ab:8d [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|                 |
|.o  . . S        |
|+o.o + .         |
|o..oB +          |
| ..*=* o         |
|..Eo=oo          |
+-----------------+

ref

0

I created a user environment variable CYGHOME that points to my %USERPROFILE%, and I immediately stopped having this problem. It didn't make a new SSH key or anything. Not like it should, either, since clone happens over HTTPS these days.

2
  • YES, thanks. I added also the varivale CYGHOME and it works fine now. I added also CYGWIN=tty ntsec just for ssh
    – user483188
    Aug 13, 2015 at 12:02
  • Where was this variable made? In the .bashrc?
    – Shinobii
    Aug 8, 2016 at 20:33
0

I copied .ssh/ corresponding to git into that corresponding to cygwin and that allowed me to use git commands in cygwin

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .