Add the correct SSH key to your agent and Git hosting account, then test the SSH connection.
Updated
Verification status
General troubleshooting guidance
Evidence
0 public source URLs
Before you change production
This page does not expose source URLs in the page body. Treat it as general troubleshooting guidance and verify against official documentation before changing systems.
Reproduce the smallest failing action and save non-secret logs before changing configuration.
Check versions for Git, related SDKs, package managers, CI runners, and hosting providers.
Change one setting or dependency at a time, then rerun the same failing command or request.
Avoid destructive commands, credential rotation, billing changes, or security relaxations without a rollback plan.
What this error means
Permission denied (publickey) means Git attempted SSH authentication, but the remote host did not accept any public key offered by your machine.
Common causes
No SSH key exists on the machine.
The key exists locally but is not loaded into ssh-agent.
The matching public key was not added to GitHub, GitLab, Bitbucket, or your internal Git host.
Multiple keys exist and SSH is offering the wrong one.
Quick fixes
Check for an existing key:
ls ~/.ssh
Add the key to your SSH agent:
ssh-add ~/.ssh/id_ed25519
Test the host connection:
ssh -T git@github.com
Confirm the repository remote uses the expected URL:
git remote -v
Step-by-step troubleshooting
Run ssh -vT git@github.com or the equivalent host command to see which keys are offered.
Add the public key from ~/.ssh/id_ed25519.pub to your Git hosting account.
If you use multiple accounts, create or update ~/.ssh/config with a host-specific IdentityFile.
Verify repository access permissions on the remote host.
Retry git clone, git pull, or git push.
Diagnostic flow for this page
Match Permission denied (publickey). exactly before applying the quick fix.
Compare the failing environment with Git versions, account scope, provider settings, and deployment context.
Check the listed common causes in order, starting with the cause that best matches your logs.
Use the evidence status below to decide whether to confirm against public sources or official documentation.
Apply one reversible change, rerun the smallest failing action, and keep rollback notes.