Coding⏱️ 2 min read📅 2026-05-30

How to Fix: GitHub Error Message - Permission denied (publickey)

Git permission denied error on GitHub push.

Quick Answer: Check your SSH keys and public repository permissions.

The 'Permission denied (publickey)' error occurs when your public key is not properly configured or is not recognized by GitHub. This can be due to various reasons such as an incorrect SSH key, a mismatch between the local and remote repositories, or an outdated SSH agent.

⚠️ Common Causes

  • Incorrectly configured SSH key
  • Mismatch between local and remote repositories
  • Outdated SSH agent

🔧 Proven Troubleshooting Steps

Method 1: Update SSH Key Configuration

  1. Step 1: Open your terminal and run the command `ssh -T git@github.com` to test your connection.

Method 2: Update SSH Agent

  1. Step 1: Run the command `ssh-agent -s` to start the SSH agent.
  2. Step 2: Add your public key using the command `ssh-add ~/.ssh/id_rsa.pub` (replace with your actual public key file).

💡 Conclusion

To resolve the 'Permission denied (publickey)' error, update your SSH key configuration and ensure that your public key is properly configured and recognized by GitHub. If you're still experiencing issues, try restarting your SSH agent or seeking further assistance from GitHub support.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions