I'm new to Github and Generating SSH Keys look a neccessity. And was informed by my boss about this, so I need to comply.
I successfully created SSH Key but when I'm going to add it to the ssh-agent
this is what happens
What seems to be the problem?
You can just restart agent by eval ssh-agent -s and add older key using ssh-add ~/. ssh/id_rsa. If you generate new SSH key then you will need to update that key in all your services such as github, bitbucket, etc.
exec ssh-agent bash – starts a new instance of the bash shell, replacing the current one. (With one or more arguments, ssh-agent doesn't output anything, but starts the specified command: in this case, the bash shell, but technically it could be anything.)
It seems you need to run ssh-agent
before using it:
eval `ssh-agent -s`
That question was answered in this topic: Could not open a connection to your authentication agent
I checked all the solutions on this post and the post that @kenorb referenced above, and I did not find any solution that worked for me.
I am using Git 1.9.5 Preview on Windows 7 with the following configuration: - Run Git from the Windows Command Prompt - Checkout Windows-style, commit Unix-style line endings
I used the 'Git Bash' console for everything... And all was well until I tried to install the SSH keys. GitHub's documentation says to do the following (don't run these commands until you finish reading the post):
Ensure ssh-agent is enabled:
If you are using Git Bash, turn on ssh-agent:If you are using another terminal prompt, such as msysgit, turn on ssh-agent:# start the ssh-agent in the background ssh-agent -s # Agent pid 59566
# start the ssh-agent in the background eval $(ssh-agent -s) # Agent pid 59566
Now of course I missed the fact that you were supposed to do one or the other. So, I ran these commands multiple times because the later ssh-add
command was failing, so I returned to this step, and continued to retry over and over.
This results in 1 Windows 'ssh-agent' process being created every single time you run these commands (notice the new PID every time you enter those commands?)
So, Ctrl
+Alt
+Del
and hit End Process
to stop each 'ssh-agent.exe' process.
Now that all the messed up stuff from the failed attempts is cleaned up, I will tell you how to get it working...
Start the 'ssh-agent.exe' process
eval $(ssh-agent -s)
And install the SSH keys
ssh-add "C:\Users\MyName\.ssh\id_rsa"
* Adjust the path above with your username, and make sure that the location of the* /.ssh directory is in the correct place. I think you choose this location during the Git installation? Maybe not...
The part I was doing wrong before I figured this out was I was not using quotes around the 'ssh-add' location. The above is how it needs to be entered on Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With