Adding an SSH key to your GitHub account from a MacBook

Amrit AdhikariAmrit Adhikari
1 min read

Adding an SSH key to your GitHub account from a MacBook involves a few steps. Here's a guide:

  1. Open Terminal on your MacBook.

  2. Generate SSH Key:

     ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    
  3. Start the SSH agent:

     eval "$(ssh-agent -s)"
    
  4. Add SSH private key to the agent:

     ssh-add -K ~/.ssh/id_rsa
    
  5. Copy SSH public key to clipboard:

     pbcopy < ~/.ssh/id_rsa.pub
    
  6. Log in to your GitHub account in a web browser.

  7. Go to "Settings" by clicking on your profile icon in the top-right corner and selecting "Settings".

  8. In the left sidebar, click on "SSH and GPG keys".

  9. Click on the "New SSH key" button.

  10. In the "Title" field, add a descriptive label for your SSH key (e.g., MacBook).

  11. Paste your SSH key into the "Key" field. You can paste it directly from your clipboard.

  12. Click the "Add SSH key" button.

  13. GitHub will prompt you to confirm adding the SSH key. Enter your GitHub password to confirm.

  14. Verify the SSH key:

    ssh -T git@github.com
    

That's it! Your SSH key should now be added to your GitHub account.

0
Subscribe to my newsletter

Read articles from Amrit Adhikari directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Amrit Adhikari
Amrit Adhikari