Add SSH Key to a Git Repository

Techie     June 2020

Git is used as a version control system. In this tutorial we are going to set up SSH to a repository. If you don’t already have a Github account, register one.

STEP 1:

Generate the SSH Key
user@local_machine
# Generate SSH key: Replace my email address in the following steps with the ones you used for your Github account.

ssh-keygen -t rsa -b 4096 -C "YOUR@EMAIL.com"

# You will get a message similar to the one below
#Enter the path and the file name after the prompt. Notice how the path matches the one above

/home/pc_user/.ssh/name_of_your_key

# You will be prompted to enter a paraphrase. You can leave it blank and press enter if you like
# Copy SSH key. This command outputs your SSH key on the terminal. Highlight everything and copy.

cat ~/.ssh/name_of_your_key.pub


STEP 2:

Copy the generated SSH key and add it to your Github repository

You do that by opening your repository, go to the settings menu of that repository. Then click deploy keys, click add and paste the key.

That’s it!

See you in the next tuts