Configuring SSH Key Authentication Between GitHub and Your Remote Server: A Step-by-Step Guide

Kristoff, Tutorial


In the world of secure and seamless connections, SSH key authentication stands out as a robust method for accessing your GitHub repositories without the hassle of passwords. This guide will walk you through the process of setting up SSH key authentication, tailored for both Linux and Windows users.

For Linux Users:

1. Open Your Terminal

Begin by launching your terminal on your machine. This is your gateway to the world of SSH key magic.

2. Generate SSH Key

In the terminal, execute the following command:


This command initiates the key generation process.


3. Confirm Path and Generate

Confirm the path for your SSH key, and press enter to generate the key. The console should display these message.


4. View and Copy the Public Key

Navigate to the directory where your key is stored:

cd .ssh

List the contents with:


Look for two keys: id_rsa (private) and (public). Open the public key with:

Open image in new tab for clearer view

Copy the code starting from "ssh-rsa" and ending at "101".

For Windows Users:

1. Open PowerShell or Git Bash

If you're using PowerShell or Git Bash, open the respective application.

2. Generate SSH Key

Execute the following command:


This command initiates the key generation process.


Confirm the path and press enter.

3. View and Copy the Public Key

Navigate to the key directory & copy the displayed code.

Adding SSH Key to Github :

1. Go to GitHub Settings

Visit the GitHub SSH and GPG Key Settings.

2. Add New SSH Key

Click on "New SSH Key" and provide a title, such as "Your PC Name. / Your Server Name"

3. Paste the Key

Paste the copied code into the "Key" section.


4. Finalize the Process

Click "Add SSH Key," and you're done!



To confirm the successful setup, run:

ssh -T


Congratulations! You've configured SSH key authentication between GitHub and your remote server. If you have further questions or need assistance, feel free to reach out.


  1. Q: Can I use the same SSH key on multiple machines?

    A: Yes, you can, but it's generally recommended to use different keys for added security.

  2. Q: What should I do if the SSH key generation fails?

    A: Double-check the path and permissions. If issues persist, regenerate the key.

  3. Q: Is SSH key authentication safer than password-based authentication?

    A: Yes, SSH key authentication is considered more secure as it eliminates the need for passwords.

  4. Q: Can I remove an SSH key from my GitHub account?

    A: Absolutely. Visit the SSH and GPG Key Settings on GitHub to manage your keys.

  5. Q: Any recommended practices for SSH key security?

    A: Keep your private key secure, use passphrases, and regularly update your keys for enhanced security.

© Kristoff