Skip to main content
github-actionsintermediateauthenticationVerified

GitHub Actions Permission Denied: Causes and Fixes

Last reviewed: 9/14/2026
3 solutions

Exact Error Message

Error: Permission denied (publickey) or Resource not accessible by integration

Quick Fix

Check workflow permissions: Go to repository Settings > Actions > General and ensure 'Read and write permissions' is enabled.

What This Error Means

This error occurs when the GitHub Actions runner doesn't have the necessary permissions to access resources, repositories, or perform operations like cloning, pushing, or accessing secrets.

Common Symptoms
  • Workflow fails with permission errors
  • Cannot clone private repositories
  • Cannot push to repositories
  • Secrets not accessible
Common Causes
  • Workflow permissions set to 'read-only'
  • Missing or incorrect SSH keys
  • Personal Access Token (PAT) has insufficient scope
  • GITHUB_TOKEN doesn't have required permissions
  • Repository access restrictions
Diagnostic Steps
  1. 1Check workflow run logs for specific permission errors
  2. 2Verify workflow permissions in repository settings
  3. 3Check if secrets are properly configured
  4. 4Verify SSH key configuration
  5. 5Test PAT permissions locally

Solutions

Solution 1: Update workflow permissions
  1. 1Go to repository Settings > Actions > General
  2. 2Under 'Workflow permissions', select 'Read and write permissions'
  3. 3Save changes
  4. 4Re-run the failed workflow
Solution 2: Configure SSH authentication
  1. 1Generate SSH key pair
  2. 2Add public key as deploy key in repository
  3. 3Add private key as repository secret
  4. 4Update workflow to use SSH for git operations

Commands to Run

Never commit private keys to repository

ssh-keygen -t ed25519 -C 'github-actions'
Solution 3: Use Personal Access Token with correct scope
  1. 1Generate PAT with repo scope (or workflow scope for Actions)
  2. 2Add PAT as repository secret
  3. 3Use PAT in workflow for authentication
  4. 4Ensure PAT has necessary permissions
Prevention Tips
  • Use GITHUB_TOKEN instead of PATs when possible
  • Grant minimum required permissions
  • Regularly rotate secrets and tokens
  • Use environment-specific secrets
  • Document permission requirements

Version Notes: Applies to GitHub Actions with new workflow permission system

Was this helpful?