Git Error: git@github.com: Permission denied (publickey)

SSH key is not loaded in `ssh-agent` or public key was not added to GitHub account.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: Git Error Platform: Git
Common Root Causes:
  • SSH key is not loaded in `ssh-agent` or public key was not added to GitHub account.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Generate Ed25519 key, add `.pub` to GitHub SSH settings, and load via `ssh-add ~/.ssh/id_ed25519`.
Safe Diagnostic Command:
ssh -T git@github.com -v
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

SSH key is not loaded in `ssh-agent` or public key was not added to GitHub account. Recommended diagnostic: `ssh -T git@github.com -v`. Remediation: Generate Ed25519 key, add `.pub` to GitHub SSH settings, and load via `ssh-add ~/.ssh/id_ed25519`.

Worked Examples

  • Run `ssh -T git@github.com -v` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-git-ssh-permission-denied-publickey · Independently verified: 2026-11-25

Related Resources