How to Add SSH Keys to Your GitHub Account via Command Line (2024)

by Christopher Maiorana

2 Minutes, 31 Seconds to Read

How to Add SSH Keys to Your GitHub Account via Command Line (1)

In this tutorial:

  • Why use an SSH key?
  • How to Create an SSH Key
  • Adding an SSH Key to Your GitHub Account

GitHub offers a convenient SSH key feature for accessing your repositories on the command line. Instead of using usernames and passwords every time you push to or pull from your repository, you can use your key. In this article we’ll learn how to add SSH keys to your GitHub account.

Why use an SSH key?

Using an SSH key is a convenient and secure way to access your account. It’s convenient because you don’t need to remember a long password. And you can make your actual password so brutally long and secure that no human or bot could guess it. The SSH key works like an actual key that only you possess.

How to Create an SSH Key

In order to use an SSH key with Git, you must first create the key on your computer. If you already have an SSH key, you can skip these steps. In order to check if you have a key, you can run this command:

 chris@server# ssh-add -l

Follow along with the steps below to create the key and copy its contents. You will need to open your computer’s default terminal application.

  1. Open the terminal app on your computer.
  2. Enter the following command, substituting [emailprotected] with your email address:
     chris@server# ssh-keygen -t rsa -b 4096 -C "[emailprotected]"
  3. Press Enter to accept the default file location.
  4. Enter a secure passphrase.
  5. Press Enter.
  6. Enter this command to display the contents of your public key:
     chris@server# cat .ssh/id_rsa.pub
  7. Copy the contents of your key to your clipboard (we will need it later).

It’s important to remember that the SSH key has two parts: a private key and a public key. As the name suggests, the private key is only for private use. Never ever share your private key with anyone (with exceptions made for your system administrator or other trusted people within your organization). This will be important later.

How to Add an SSH Key to your Github Account

Now we have already seen why you might want to use an SSH key. We also demonstrated how to create an SSH key on your computer.

As mentioned above, we have a private key and a public key. In the steps below you’ll learn how to upload your public key to GitHub.

  1. Log into your GitHub account.
  2. Click your avatar and choose Settings
    How to Add SSH Keys to Your GitHub Account via Command Line (2)
  3. Select SSH and GPG keys
    How to Add SSH Keys to Your GitHub Account via Command Line (3)
  4. Click New SSH key
    How to Add SSH Keys to Your GitHub Account via Command Line (4)
  5. Enter a title in the field
    How to Add SSH Keys to Your GitHub Account via Command Line (5)
  6. Paste your public key into the Key field
    How to Add SSH Keys to Your GitHub Account via Command Line (6)
  7. Click Add SSH key
    How to Add SSH Keys to Your GitHub Account via Command Line (7)

Next Steps

Well done! You now know how to add SSH keys to your GitHub account. Make sure to check out some of our other Git articles:

Looking for a dedicated server? We’ve got you covered.

CM

Christopher MaioranaContent Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Related Articles

How to Add SSH Keys to Your GitHub Account via Command Line (2024)
Top Articles
Just hours until final October $4,555 payment drops - see full schedule
The Financial Advice Your Parents Gave You Is… Outdated. Here’s What to Do Instead
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
Non Sequitur
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Allyn Kozey

Last Updated:

Views: 5973

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Allyn Kozey

Birthday: 1993-12-21

Address: Suite 454 40343 Larson Union, Port Melia, TX 16164

Phone: +2456904400762

Job: Investor Administrator

Hobby: Sketching, Puzzles, Pet, Mountaineering, Skydiving, Dowsing, Sports

Introduction: My name is Allyn Kozey, I am a outstanding, colorful, adventurous, encouraging, zealous, tender, helpful person who loves writing and wants to share my knowledge and understanding with you.