How to Set Up SSH on GitHub, 6 Easy Steps to Follow!

Setting up the SSH private and public keys is one of the most frequent problems encountered when starting started with Git and GitHub. On top of that, GitHub no longer supports Git password authentication.

You can no longer access Git on GitHub using your GitHub account password as of August 13, 2021. Making an SSH key and closing your Git repositories with SSH is a quick and significantly more secure way to connect with your GitHub repositories.

Table of Content

Things You Should Know About SSH

  • SSH allows you to log in to a server, such as GitHub, without disclosing your username or password.
  • The cryptographic protocol known as SSH, or Secure Shell, is founded on the idea of public-private keys.
  • Git uses SSH because it is both quicker and more secure than constantly putting in your login and password.
  • You’ve probably noticed that GitHub is complaining about the lack of an SSH key on your computer.

How to Add SSH on Git

Follow the steps below to add your SSH on Git!

Step 1: Git installation

  • By using the following command in any open terminal, you can determine whether Git is already installed:
git --version
  • You must install Git if you receive an error message. In any case, I advise setting up or updating Git.
  • Open https://git-scm.com right away. I can currently see version 2.30.0.
  • Open the installer that you downloaded and proceed with the installation. Leave all settings at their defaults unless you are an expert.
  • A new program called Git Bash, a terminal substitute for Cmd or Powershell, has also been installed by this wizard.
  • Run the following command from Git Bash or any terminal of your choosing.
See Also  How to Make a GitHub Repository Private

Step 2: Setting up Git

  • Please modify the commands below with your name and email before continuing. Any modifications you make to any Git repository will include them. Do it right away to avoid losing points with your coworkers.
git config --global user.name “Your Name”

git config --global user.email “you@example.com

Step 3: Clone a GitHub repository

  • Go to the repository you wish to clone after logging into your GitHub account. I’m assuming you’re cloning your own repositories, whether they be public or private, in order to make changes.
  • If SSH is not already selected, click the green Code button, pick it, and then copy the address that appears.
  • Execute the command below.
git clone (PASTE HERE YOUR ADDRESS)
  • You shouldn’t be concerned if you see a warning that reads, “The legitimacy of host ‘github.com’ can’t be determined.” You will get this warning if this is your first time connecting to this server. If you choose “yes,” it won’t annoy you ever again.

Step 4: Making an SSH key

  • Ssh-keygen will be the tool we employ. So launch a terminal and enter the following command:
Ssh-keygen
  • You will first be questioned about where the keys should be kept. Your user folder will by default include a folder named .ssh. Simply leave it alone and press Enter.
  • You will then be prompted to choose a password to secure your private key. Anyone who obtains your private key without a password can pretend to be you.
  • Setting a password is a good idea, but it can be difficult to do it in Windows such that you don’t have to enter it each time you execute a Git command. Therefore, keep it blank for the time being, and simply press Enter twice.
  • A pair of your public and private keys have been created.
  • To review what you currently have:
See Also  How to Install The FNF GitHub Browser

id_rsa. This is your PRIVATE key. Never share this with anyone else. It’s your little secret.

id_rsa.pub. This is your PUBLIC key. There are no surprises in this. It can be distributed to others.

Step 5: Adding your SSH key to GitHub

  • Open your public key in your preferred text editor. To inspect the file’s contents, I’ll use the terminal and the cat command.
  • Copy the file’s content in its entirety.
  • Go to your profile settings in GitHub to get your SSH and GPG keys.
  • Click Add SSH key after pasting your public key into the substantial text box that appears on the screen. You should definitely give your key a name so you can remember it later.

Step 6: Clone a GitHub repository (again)

  • It is now time to issue the clone command once more, and it ought to succeed.
  • Any tools or code editors you may be using now integrate with Git. Changes from GitHub can be pushed and pulled without any problems.

Tips

  • The SSH key feature on GitHub makes it easy to access your repositories from the command line.
  • You can use your key instead of your username and password every time you push to or pull from your repository.
  • Using an SSH key to log into your account is a quick and safe way to do so. It’s convenient because you don’t have to remember a long password.
  • You can make your real password so long and hard to guess that neither people nor computers could figure it out. The SSH key works just like a real key that you alone have.

Share This Post

Newest Articles

How to Get a GitHub Access Token for Personal Access

No longer have access to your personal GitHub repository? You can use the GitHub Access Token to open it. Read the full guide here!

How to Make a GitHub Repository Private

Developers can now create a private GitHub repository in the free tier as of January 7, 2019. Read how to get the private repository feature on GitHub here!

3 Methods of How to Install Android SDK Repository

Android is one of the most used operating systems for software development. Read the full guide on how to get the Android SDK here!

How to Turn Off Android Developer Mode

Android Developer Options allows you to access hidden features. If you want to deactivate it, follow this simple guide to turn it off!

5 Simple Ways How to Get Cookie Clicker GitHub

How to get and use Cookie Clicker on GitHub? You can find the simple steps and cheats for Cookie Clicker in this article!

How to Integrate Jira with GitHub in 6 Easy Steps

If you use Jira for your work and need to integrate with another organization that uses GitHub, integration is what you require. Read the details here!