I have an SSH key saved in D:/keys folder
. I want to add it to my git bash. All the tutorials I found is how to generate SSH key using gitbash and load it to github/gitlab. I generated my SSH key using puttygen. Now I want to add it to my git bash so that I can clone a repository from remote. How can I do that?
On windows you might need to start the ssh agent like this
# start the ssh-agent in the background
$ eval $(ssh-agent -s)
> Agent pid 59566
Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
$ ssh-add <path/to/key>
Got this information from here under "Adding your SSH key to the ssh-agent": https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent
I don't think there is any specific config in gitbash itself. You have to put the key in the default location ~\.ssh/id_rsa
and it will be used. If you need to have it somewhere else you could do so with a config file same as on Linux ~/.ssh/config
host example.com
HostName example.com
IdentityFile ~/.ssh/id_rsa
User git
Don't forget to set the permissions chmod 400 ~/.ssh/id_rsa
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