How to Set up and Use GitHub SSH: Step-by-Step Tutorial

In this tutorial, we will guide you through the process of generating a new GitHub SSH key and adding it to the SSH agent, so you can securely connect to GitHub using SSH.

Let’s get started!

1. Open your terminal and use the following command to generate a new SSH key:

ssh-keygen -t ed25519 -C ""

Replace “” with your own email address. The system will prompt you to enter a filename to save the key. If you are happy with the default filename, press Enter.

2. Next, you will be asked to enter a passphrase. This is an optional security feature that can help protect your SSH key in case someone gains access to your computer. If you want to use a passphrase, enter one here, otherwise, press Enter.

You have successfully generated your SSH key pair. The public key is saved as, and the private key as myssh_id.

3. Now let’s add the private key to the SSH agent. Start the SSH agent in the background using the following command:

eval "$(ssh-agent -s)"

4. The system will confirm that the SSH agent is running. Add the private key to the agent using this command:

ssh-add ~/.ssh/myssh_id

Make sure to replace myssh_id with the name of your private key file if you used a different filename during the key generation process.

5. Finally, add the public key to your GitHub account. Log in to your account and navigate to your account settings.

6. Click on “SSH and GPG keys” in the left sidebar…

7. Click the “New SSH key” button.

Enter a title for the key and copy the entire contents of the public key file ( into the “Key” field. Click “Add SSH key” to save the new key to your account.

That’s it! You have now generated a new SSH key and added it to the SSH agent and your GitHub account. You can now use SSH to connect to your GitHub repositories securely without having to enter your username and password every time.

We hope you found this tutorial helpful. If you have any questions or comments, please leave them below. Thank you for reading!

Share your with friends