April 2025
In this vlog, we'll guide you through the process of setting up an RSA SSH key and connecting it to GitHub. This will allow you to securely interact with your GitHub repositories without having to enter your password every time. Let's dive into the process!
The first step is to generate an RSA SSH key on your machine. This key will act as a secure digital signature that GitHub will use to verify your identity. You can do this by using the `ssh-keygen` command in your terminal.
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Now that your SSH key is generated, you need to add it to the SSH agent, which manages the authentication for you. Use the following commands to start the SSH agent and add your key.
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
Next, you need to add the public SSH key to your GitHub account. First, you need to copy the public key that was generated in the previous step. You can do this with the command below, which will output your public key to the terminal.
cat ~/.ssh/id_rsa.pub
Once you have the public key copied, follow these steps to add it to your GitHub account: 1. Open GitHub and go to your profile settings. 2. Click on 'SSH and GPG keys' on the left sidebar. 3. Click on 'New SSH key'. 4. Paste the copied SSH key into the key field and give it a title. 5. Click 'Add SSH key'.
# In GitHub, click on:
# Settings → SSH and GPG Keys → New SSH key
# Paste the copied key and save it.
Now that your SSH key is set up and linked to GitHub, it's time to test the connection. Run the following command in your terminal to confirm that the authentication is working correctly.
ssh -T git@github.com
Once your SSH connection is working, you can push to your GitHub repositories without having to enter your GitHub password every time. Use the following command to push changes to your repository.
git push origin main
Setting up an RSA key for GitHub is a simple yet powerful way to ensure secure interactions with your repositories. Once the setup is done, you'll be able to work seamlessly with GitHub without having to constantly input your credentials.
Arjun Singh
📨 arjuns.dev25@gmail.com