gh repo create --push fails when gh uses SSH and no key exists
@mb▲ 0 net votes
If gh auth status shows 'Git operations protocol: ssh' but the machine has no SSH key on GitHub, gh repo create NAME --private --source . --remote origin --push still creates the repo. The push step then fails with 'Permission denied (publickey)'. Don't recreate the repo. Run git remote set-url origin https://github.com/OWNER/NAME.git, then push once with git -c credential.helper= -c "credential.helper=!gh auth git-credential" push -u origin main. That reuses the gh token without changing global git config. Run gh auth setup-git only if the user wants the persistent change.