Some common problems of ssh keys in GitHub Back

1. Checking for existing SSH keys

Mac Windows Linux
  1. Open Terminal.
  2. Enter ls -al ~/.ssh to see if existing SSH keys are present.
  3. Check the directory listing to see if you already have a public SSH key.
  4. If not, generate a new one.
  1. Open Git Bash.
  2. Enter ls -al ~/.ssh to see if existing SSH keys are present.
  3. Check the directory listing to see if you already have a public SSH key.
  4. If not, generate a new one.
  1. Open Terminal.
  2. Enter ls -al ~/.ssh to see if existing SSH keys are present.
  3. Check the directory listing to see if you already have a public SSH key.
  4. If not, generate a new one.

2. Generating a new key

Mac Windows Linux
  1. Open Terminal.
  2. Paste the text below, substituting in your GitHub email address.
    $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
  4. At the prompt, type a secure passphrase.
  1. Open Git Bash.
  2. Paste the text below, substituting in your GitHub email address.
    $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
  4. At the prompt, type a secure passphrase.
  1. Open Terminal.
  2. Paste the text below, substituting in your GitHub email address.
    $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
  4. At the prompt, type a secure passphrase.

3. Adding SSH keys to the ssh-agent

Mac Windows Linux
  1. Ensure ssh-agent is enabled:
    $ eval "$(ssh-agent -s)"
  2. Add your SSH key to the ssh-agent.
    $ ssh-add ~/.ssh/id_rsa
  1. Ensure ssh-agent is enabled:
    • If you are using Git Bash, turn on ssh-agent:
      $ eval "$(ssh-agent -s)"
    • If you are using another terminal prompt, such as Git for Windows, turn on ssh-agent:
      $ eval $(ssh-agent -s)
  2. Add your SSH key to the ssh-agent.
    $ ssh-add ~/.ssh/id_rsa
  1. Ensure ssh-agent is enabled:
    $ eval "$(ssh-agent -s)"
  2. Add your SSH key to the ssh-agent.
    $ ssh-add ~/.ssh/id_rsa

4. Testing SSH connection

Mac Windows Linux
  1. Open Terminal.
  2. Enter the following:

  3. ssh -T git@github.com
  4. Verify that the resulting message contains your username. If you see a message that contains "access denied," see "Error: Permission denied (publickey)".
  1. Open Git Bash.
  2. Enter the following:

  3. ssh -T git@github.com
  4. Verify that the resulting message contains your username. If you see a message that contains "access denied," see "Error: Permission denied (publickey)".
  1. Open Terminal.
  2. Enter the following:

  3. ssh -T git@github.com
  4. Verify that the resulting message contains your username. If you see a message that contains "access denied," see "Error: Permission denied (publickey)".
Empty Comments
Sign in GitHub

As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.

Notice: This plugin has used Cookie to store your token with an expiration.