ssh key setup¶
Using SSH authentication for communicating with remote repos is generally easier than using https. Sometimes it's required for certain repos or by rules set at the hosting level.
Here's how to get set up with SSH keys
- Create an SSH public/private key pair (skip this if you already have one!)
- open git bash (or any other terminal that has git available)
- type
ssh-keygen
and press enter- press enter to answer each of the following questions with the default answers
- as long as you saved your SSH key to the default location, enter the following command:
cat ~/.ssh/id_rsa.pub
- highlight and copy the output (starts with
ssh-rsa
and ends withusername@computer_name
) - navigate to your SSH key settings on your git hosting and add your key to your profile
- Clone or add the remote to an existing repo per the instructions on the project page using the ssh URL scheme (instead of
https://
)git clone git@gitawse1.hagerty.com:<username>/<project>
git remote add origin git@gitawse1.hagerty.com:<username>/<project>
- Profit??$?
You should now be able to use SSH URLs for connections between your terminal and the remote that you copied the key to