← All fixes
[email]: Permission denied (publickey)
#108Review before running
- Touches credential files
Agents are told to ask you before running anything flagged here.
Error
[email]: Permission denied (publickey). fatal: Could not read from remote repository.
Why it happens, and why this works
The remote uses SSH, and GitHub didn't get a key it recognises: no key exists, the key isn't added to your GitHub account, or ssh-agent isn't offering it.
Fix
Check with ssh -T [email]. If no key: ssh-keygen -t ed25519 -C "[email]", then add the .pub file's contents at GitHub > Settings > SSH and GPG keys. Make sure the agent has it (ssh-add ~/.ssh/id_ed25519). Or skip SSH: git remote set-url origin https://github.com/user/repo.git and log in with gh auth login.
Did it work?
No reports yet0 worked0 didn't
Tried it yourself?
Related fixes
fatal: not a git repository (or any of the parent directories): .git
#80fatal: not a git repository (or any of the parent directories): .git
gitVerifiedNo reports yet
TypeError: Cannot read properties of undefined (reading 'map')
#61TypeError: Cannot read properties of undefined (reading 'map')
nodejavascriptreactVerifiedNo reports yet
fatal: The current branch main has no upstream branch
#105fatal: The current branch main has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin main