3

my machine setup is as follows: windows 7, Git for windows,Git Bash, openSSH 1.6 installed via cygwin.

I followed the instructions on https://help.github.com/articles/generating-ssh-keys

But I still have to login in everytime I push something.

I guess my setup is messed up... any help is very much appreciated.

goTAN
  • 587
  • 1
  • 7
  • 15

4 Answers4

4

To be able to use key-based authentication (instead of HTTP basic-auth), you have to use the SSH-Protocol. On Github, the URLs look like this:

git@github.com:username/repository.git

Once you use key authentication, you can use the common SSH tools to manage the connections. One of these tools is the SSH agent which will decrypt your private key once after loading and keep it in main memory while it is running. This allows new SSH sessions to use this key without having to bother you with a password-question.

You can add a private key to the current SSH agent session by running

ssh-add /path/to/key
Holger Just
  • 52,918
  • 14
  • 115
  • 123
  • when I try to add the key to my ssh agent I get the error: Could not open a connection to your authentication client.When I do ps -a on cygwin I can just see /usr/sbin/sshd process running.The funny thing is, that I cant see this process on my git bash. Instead there is a use/bin/ssh-agent. I really thing I messed up something... – goTAN Feb 22 '13 at 11:05
  • @goTAN the connection problem is an issue with cygwin's ssh client. See here: http://stackoverflow.com/questions/17695337/cygwins-ssh-add-returns-could-not-open-a-connection-to-your-authentication-age/17695338#17695338. If you follow Holger's answer and the answer in my link - you should be good to go. – Chris Snow Jan 13 '14 at 14:02
1

If you want to remove the passphrase and it annoys you then enter:

ssh-keygen -p

enter the old passphrase and when asks for the new one, just leave it empty.

Qiu
  • 5,651
  • 10
  • 49
  • 56
Gyula Soós
  • 467
  • 1
  • 9
  • 23
0

I now got it working kinda... At first I uninstalled the ssh package from cygwin since git for windows ships with ssh.

like Holger said I had to add the key to the ssh-agent but from the git bash I was not able to add it. It worked like this:

eval 'ssh-agen.exe'

ssh-add ~/.ssh/id_rsa

After this I was able to push without entering a passphrase. The only problem got left is that I have to add the key after every system reboot...

ANy ideas how to fix this?

goTAN
  • 587
  • 1
  • 7
  • 15
0

These instructions are for Windows 7 and above.

  1. Create a filename named .bashrc in your home directory (so full file path is C:\Users\XYZ\.bashrc where XYZ is your windows user name
  2. In the file add these two lines. Note: change location of private key file if not at ~/.ssh/id_rsa

    eval `ssh-agent`

    ssh-add ~/.ssh/id_rsa

  3. Open Git Bash application and you should be prompted with asking for your key's password

Jonathan Airey
  • 416
  • 1
  • 5
  • 17