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 of https://github.com/.
  • gh auth login was run with SSH selected instead of HTTPS.
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.

Full help articlegh auth login doesn't open the browser, or the code expires

Last reviewed Nov 8, 2026