PlainError

Home / Coding

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

Last checked 2026-10-17 · 3 fixes · reviewed answer

TL;DRThis error happens when Git cannot connect to a remote code repository because the computer lacks the correct SSH key permission.

Likely causes

  1. SSH key not added to the remote account or agentmost likely
  2. Wrong remote URL or key file permissionspossible
  3. Key file missing or not generatedless likely

How to fix it

Safest first: SafeChanges settingsDangerous
  1. Check current SSH keysSafe

    List the SSH keys present on the system to see if any exist.

    ls -la ~/.ssh
  2. Test connection to the remoteSafe

    Run a simple SSH test to confirm the permission issue.

    ssh -T git@your-remote-host
  3. Add key to SSH agentChanges settings

    Start the agent and load the key so Git can use it.

    ssh-add ~/.ssh/id_rsa

If that didn't fix it

You will continue to be unable to push or pull changes from the remote repository.

When to see a technician

Consult a technician if you are unsure which key belongs to the repository or if the remote account access needs to be reset.

Did this fix it? Report a problem

Related errors