Security & Auth Error

Fix "Permission denied (publickey)" in SSH & GitHub

Developer guide and instant terminal command to diagnose and solve this error.

Terminal Output
$git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

Why Does This Error Happen?

Your SSH client did not offer a public key recognized by the remote server, or file permissions on ~/.ssh/id_rsa are too permissive.

Instant Terminal One-Liner Fixes

Linux (Bash / Zsh)
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_* && ssh-add ~/.ssh/id_*
macOS (Terminal / iTerm2)
chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_* && ssh-add ~/.ssh/id_*
Windows (PowerShell Run as Administrator)
icacls "$env:USERPROFILE\.ssh\id_rsa" /inheritance:r /grant:r "$($env:USERNAME):R"

Comprehensive Step-by-Step Resolution

  1. 1Fix SSH key file permissions: "chmod 600 ~/.ssh/id_ed25519" and "chmod 700 ~/.ssh".
  2. 2Add key to SSH agent: "ssh-add ~/.ssh/id_ed25519".
  3. 3Test GitHub connectivity: "ssh -T git@github.com".
Dedicated Companion Tool

Troubleshoot using the chmod 600 SSH Key Security Guide

Use our client-side utility with zero server upload for instant debugging.

Open Tool

Frequently Asked Questions

Frequently Asked Questions

Frequently Asked Questions

Everything you need to know regarding specifications, syntax, and security best practices.

Your SSH client did not offer a public key recognized by the remote server, or file permissions on ~/.ssh/id_rsa are too permissive.