Lesstep
GitHub · SSH keys · Checked November 22, 2026

Connect to GitHub over SSH

Create a key with ssh-keygen -t ed25519, add the public key to your GitHub account, and test with ssh -T git@github.com. A reply that starts with "Hi USERNAME!" means it works. An SSH key is only for Git (clone, fetch, push). The GitHub REST API, which an IDE plugin uses to read pull requests, does not accept an SSH key; it needs a token.

Create a key and add it to the agent

From GitHub's Generating a new SSH key and adding it to the ssh-agent:

ssh-keygen -t ed25519 -C "your_email@example.com"

For a system that does not support Ed25519, GitHub gives ssh-keygen -t rsa -b 4096 -C "your_email@example.com". Then start the agent and add the key:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

On macOS GitHub uses ssh-add --apple-use-keychain ~/.ssh/id_ed25519. On Windows, start the agent in an elevated PowerShell, then add the key in a normal one:

Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent
ssh-add c:/Users/YOU/.ssh/id_ed25519

Git for Windows may use its bundled ssh.exe instead of the Windows agent, so it keeps asking for the passphrase. GitHub's fix is to point Git at the system client:

git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"

Pull Request Inbox for GitHub, a plugin for JetBrains IDEs, reads pull requests through GitHub's REST API with a token, and checks out a pull request's branch with the Git remote you already have, SSH or HTTPS.

Add the public key to your account

From Adding a new SSH key to your GitHub account. Copy the public key (the file ending in .pub), for example on macOS:

pbcopy < ~/.ssh/id_ed25519.pub

On Windows in PowerShell, cat ~/.ssh/id_ed25519.pub | clip. Then on GitHub:

  1. Click your profile picture, then Settings.
  2. In the sidebar, click SSH and GPG keys.
  3. Click New SSH key (or Add SSH key).
  4. Give it a Title, set Key type to Authentication Key, and paste the key into the Key field.
  5. Click Add SSH key. If GitHub asks, confirm your access.

Never paste the private key (the file without .pub).

Test it, and what the answers mean

From Testing your SSH connection:

ssh -T git@github.com

On the first connection SSH shows a host warning:

The authenticity of host 'github.com (IP ADDRESS)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
Are you sure you want to continue connecting (yes/no)?

Compare the fingerprint with GitHub's SSH key fingerprints. GitHub publishes these:

Type yes only if it matches. Success looks like this:

Hi USERNAME! You've successfully authenticated, but GitHub does not
provide shell access.

The command exits with code 1 even then; that is expected, because GitHub gives no shell. Check that the name in the message is yours. A reply of Permission denied (publickey). means the server rejected the connection; see the next section.

"Permission denied (publickey)"

GitHub's page Error: Permission denied (publickey) lists the checks. In short:

Port 22 is blocked: SSH over port 443

From Using SSH over the HTTPS port. Test it with the host ssh.github.com (not github.com):

ssh -T -p 443 git@ssh.github.com

To make every connection to github.com use it, put this in ~/.ssh/config:

Host github.com
    Hostname ssh.github.com
    Port 443
    User git

Then ssh -T git@github.com goes through port 443. The first connection can show the host key warning again, because the host is recorded under a different name; compare the fingerprint before you answer yes. GitHub notes that proxy servers may still interfere, and that this is not supported on GitHub Enterprise Server or GitHub Enterprise Cloud with data residency. Without the config block, clone with git clone ssh://git@ssh.github.com:443/YOUR-USERNAME/YOUR-REPOSITORY.git.

Switch a remote from HTTPS to SSH

From Managing remote repositories. In the project folder:

git remote -v
git remote set-url origin git@github.com:OWNER/REPOSITORY.git
git remote -v

The second git remote -v should show the new git@github.com: address.

SSH keys are for Git, not for the API

An SSH key proves who you are to Git. Tools that read pull requests, checks and reviews call the GitHub REST API over HTTPS, and that takes a token, not an SSH key. So a working ssh -T does not log an IDE plugin in, and the other way round: a token does not let Git push over SSH. If the API refuses the token, see 401 "Bad credentials".

GitHub pull requests in IntelliJ IDEA

Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, reads pull requests through GitHub's REST API with a personal access token kept in the IDE's password safe (one for github.com, one for a GitHub Enterprise Server), sent only to its own host. Checking out a pull request's branch uses your Git remote, SSH or HTTPS, as you configured it. The review inbox across repositories, diffs, viewed marks, conversations, merge checks, checks and checking out the branch are free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).

Get it on JetBrains Marketplace

GitHub is a trademark of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitHub, Inc. or JetBrains.

More: 401 "Bad credentials" · GitHub 404 "Not Found" · GitHub pull request checkout failed · GitHub Enterprise Server not reached · "Resource not accessible by personal access token" · GitHub push refused: GH006 and GH013 on a protected branch · GitHub pull request plugins for IntelliJ IDEA, compared · 日本語