Skip to content
Back to Error Database
Git/SSH

Permission denied (publickey) — Git SSH error

The CI runner cannot authenticate with the Git remote. The SSH key or deploy key is missing, expired, or doesn't have the necessary permissions.

Root Cause

The GITHUB_TOKEN or deploy key used by the workflow doesn't have read/write access to the repository. Common causes: wrong secret name, expired token, fork PR restrictions, or missing 'permissions: contents: write' in the workflow.

How to Fix
  1. 1Check if your workflow has a 'permissions' block — add 'contents: write' if pushing commits
  2. 2For deploy keys: verify the key is added in repo Settings → Deploy Keys
  3. 3For private submodules: use 'persist-credentials: true' in actions/checkout
  4. 4For forks: note that GITHUB_TOKEN has read-only access for fork PRs (security feature)
Commands
# Add permissions to workflow:
permissions:
  contents: write
  pull-requests: write

# Or use a PAT:
- uses: actions/checkout@v4
  with:
    token: ${{ secrets.PAT_TOKEN }}
Prevention

Use the minimum required permissions. For cross-repo access, create a GitHub App or use a scoped PAT stored in repo secrets.

Automate This

WarpFix detects "Permission denied (publickey) — Git SSH error" automatically and opens a fix PR — before you even see the error.

WarpFix monitors your GitHub repos 24/7. When CI fails, it identifies the error, generates a fix, validates it in a sandbox, and opens a PR — automatically.

Install WarpFix — Free