I\'m working on a project in a private repository on https://www.bitbucket.com.
I\'m coding it locally, then staging, commiting and pushing the update via BitBucket\'s /
To whom may have the same issue on Mac with new Sierra. Solution would be to add private key to SSH agent via:
ssh-add -K ~/.ssh/id_rsa
It looks like that identity[id_rsa] doesn't persist by SSH agent.
Note this is not a permanent solution .. You would need to do that each time you clone a new repository.At least then no need to provide private key for each push to remote.
-------- Update 28.Sep.2017 --------
Permanent solution ( On Sierra):
Steps:
1- Be sure that you have a running ssh-agent in background before doing anything.
To check if ssh-agent is running by:
pgrep 'ssh-agent'
That command returns PID (ProcessID) of that process if it's running. If you see a value.. Go to Step#2. if not, so you need to run that agent in background by:
eval "$(ssh-agent -s)"
2- Edit ~/.ssh/config
(Create if it doesn't exist as su
):
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
3- Then add that key agent ( that would be once ):
ssh-add -K ~/.ssh/id_rsa
That's it.
Actually Step#2 is the crucial one. I just want to provide a complete guide.
I hope that may help you.'.
This is an old question, but every time there is a MacOS update, I came across this issue. Catalina was no exception.
First, you should check your config file to confirm if your old keys still there... it should:
~ ls -al ~/.ssh
Then you have to add again your key(s) by the name listed above:
~ ssh-add -K ~/.ssh/[key-name]
This happened to me after updating my Sourcetree on my Mac.
What worked for me was just simply removing everything in the ~/.ssh/
folder except the .config
and the known_hosts
folders. Then simply go to sourcetree under preferences, remove your github account, re-add the profile again after deleting all the .ssh
public and private keys and sourcetree should re-add the keys locally and to GitHub
Well - I've found the solution after much trial and error.
Apparently, using PUTTY's keygen and storing the new public key in my .ssh
folder doesn't work.
However, using ssh-keygen
IN GIT BASH and then trying to login using the new generated key pair, works just fine.
Out of curiosity though more than anything - I would love to know why this is the case.
I know this is resolved, but to add to the accepted answer, you don't actually need Git Bash in order for this to work. As Cupcake said, it is true that PuTTY puts out .ppk
files for private keys, which won't work outside the usual PuTTY/Pageant context.
This is because the terminal expects by default to find a file named id_rsa
in ~/.ssh
and PuTTY doesn't generate that by default. Git Bash's ssh-keygen
does though, which is why Tom Granot's solution works.
You CAN, though, through the PuTTY key generator, export the same exact file through the Conversions/Export OpenSSH Key...
option in the menu. Just be sure to name it id_rsa
and have it sit next to your id_rsa.pub
file, and everything should work fine.
I needed to further modify these settings SourceTree: