Skip to content
Discussion options

You must be logged in to vote

Solution: Fix GitHub Permission denied (publickey) Error

Problem

When pushing code to GitHub, you may see this error:

Permission denied (publickey).
fatal: Could not read from remote repository.

This means GitHub cannot authenticate your computer using SSH.


Step 1: Check Existing SSH Key

First, check if you already have an SSH key on your computer.

ls ~/.ssh

Look for a file like:

id_ed25519.pub

or:

id_rsa.pub

If one of these files exists, you already have an SSH public key.


Step 2: Generate a New SSH Key

If you do not have an SSH key, create one using this command:

ssh-keygen -t ed25519 -C "your-email@example.com"

Replace your-email@example.com with the email address connected to your…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Moparapairayat
Comment options

Answer selected by shwon908
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GitHub or a GitHub feature is not working as intended Pull Requests Propose, review, and discuss changes to a repository's codebase Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates
2 participants