Bilo Guides FAQ

"Permission denied (publickey)" on git push to GitHub: the fix

When you push over SSH, GitHub wants to see a key that is attached to your account. This error means your computer offered no key, or offered one GitHub does not know.

The error looks like this:

git@github.com: Permission denied (publickey).

How to fix it

  1. Don't use sudo with Git. GitHub's guide says keys made without sudo will not be used by sudo git push.
  2. Test the connection. Run ssh -T git@github.com. Success prints a greeting with your username. Use the user git, not your GitHub username, in the address.
  3. Check a key is loaded. Run eval "$(ssh-agent -s)" and then ssh-add -l -E sha256. If the list is empty, create an SSH key and add it to GitHub.
  4. See what SSH offers. Run ssh -vT git@github.com. A line with "Offering public key" means your key was found and sent.
  5. Match it to your account. Compare the fingerprint with the keys under Settings, then SSH and GPG keys on GitHub. If yours is missing, add the public key.
  6. Or switch to HTTPS. If SSH is a hassle, change the remote to the HTTPS address with git remote set-url origin <https-url>.

What you should see

ssh -T git@github.com greets you by username, and git push goes through.

Not fixed? Bring the exact message to Bilo and we will look at it with you.

Still stuck? Paste your error into Bilo

Quick questions

Which file do I upload to GitHub?

The public key (the file ending in .pub). Never share the private one.

It worked yesterday.

The key may no longer be loaded into the agent after a restart. Run ssh-add for it again.

I see a key on my account I don't recognise.

GitHub's guide says to delete it right away and contact GitHub Support.

Sources and date checked

Written in our own words from the official pages above. Tool names are only references; we are not affiliated with them. Commands change between versions, so check the linked docs if something differs.

Tell us your idea and get a blueprint with an estimated cost, free.

Start the free interview

Bilo works by connecting to your own AI (Claude, ChatGPT, …). You need an account with that AI, and the usage for writing things comes out of your own AI plan.