Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH Key - Still asking for password and passphrase

I've been somewhat 'putting up' with Github always asking for my username and password when I clone a repository. I want to bypass this step because it is an annoyance within my workflow.

I tried setting up an SSH key (which I successfully did) using this guide. https://help.github.com/articles/generating-ssh-keys and I was successful.

My problem is that I am still asked for my github password and passphrase when cloning a repository (using SSH). My understanding was that after I set up this SSH key, I would no longer have to do that.

I am a little unsure what to ask, so I will just state my goal.

I want to be able to clone repositories without having to put in my Github information all the time.

What am I missing with my SSH key? If anyone can provide some guidance or resources I would appreciate it, because I've always felt a little lost when it came to SSH authentication in GitHub.

From my knowledge, this is a command that tests if things are working properly, here are the output from my console:

~ $ ssh -T [email protected] Saving password to keychain failed Enter passphrase for key '/Users/MYNAME/.ssh/id_rsa': Hi MYNAME! You've successfully authenticated, but GitHub does not provide shell access. 

When I input my password, should that fail first? Then, when I enter my passphrase, it passes.

like image 910
HelloWorld Avatar asked Jan 13 '14 15:01

HelloWorld


People also ask

Why does SSH keep asking for passphrase?

There may be times in which you don't want the passphrase stored in the keychain, but don't want to have to enter the passphrase over and over again. This will ask you for the passphrase, enter it and it will not ask again until you restart.

Why is SSH key not working?

Make sure the authorized_keys file and the private key itself have the correct permissions and ownership. Check that key-based authentication is allowed by the server. Make sure the private key is readable by the SSH client. If you're using PuTTY, make sure your SSH keys are properly configured for the session.

Do I need a password with SSH key?

Adding a password to your SSH key means that the private key will be stored encrypted on your local machine. That private key is a rather sensitive secret since knowing that key grants access to all servers on which you registered the corresponding public key (in your . ssh/authorized_keys file).


2 Answers

Add Identity without Keychain

There may be times in which you don't want the passphrase stored in the keychain, but don't want to have to enter the passphrase over and over again.

You can do that like this:

ssh-add ~/.ssh/id_rsa  

This will ask you for the passphrase, enter it and it will not ask again until you restart.

Add Identity Using Keychain

As @dennis points out in the comments, to persist the passphrase through restarts by storing it in your keychain, you can use the -K option (-k for Ubuntu) when adding the identity like this:

ssh-add -K ~/.ssh/id_rsa 

Once again, this will ask you for the passphrase, enter it and this time it will never ask again for this identity.

like image 64
Komu Avatar answered Sep 23 '22 23:09

Komu


If you work with HTTPs urls, it'll always ask for your username / password.

If you're correctly using SSH when cloning / setting remotes. Then make sure you have a ssh-agent to remember your password. That way, you'll only enter your passphrase once by terminal session.

If it is still too annoying, then simply set a ssh-key without passphrase.

like image 26
Simon Boudrias Avatar answered Sep 23 '22 23:09

Simon Boudrias