Skip to content

Latest commit

 

History

History
70 lines (61 loc) · 4.75 KB

github_ssh.md

File metadata and controls

70 lines (61 loc) · 4.75 KB

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)".