Terminal
git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.
- What it means
- Git tried to connect to GitHub using SSH keys instead of your signed-in GitHub CLI HTTPS connection.
- Likely causes
- The repository remote URL starts with
git@github.com:instead ofhttps://github.com/. gh auth loginwas run with SSH selected instead of HTTPS.
- The repository remote URL starts with
- Prevention
- Always choose HTTPS (not SSH) when running
gh auth login.
Copy for your agent
Git failed with `Permission denied (publickey)`. Switch our repo's remote URL to HTTPS and run `gh auth setup-git` so Git uses my GitHub CLI login.
Was this page helpful?