How to Fix “Permission Denied” in GitHub Actions (2026 Guide)

The Short Answer

To fix the “Permission Denied” error in GitHub Actions, advanced users can update their secrets configuration by ensuring that the actions/checkout step has the necessary permissions, and then re-run the workflow. This typically involves adding a permissions block to the workflow file with the required permissions, such as contents: read and actions: read.

Why This Error Happens

  • Reason 1: The most common cause of the “Permission Denied” error in GitHub Actions is an incorrect or missing permissions block in the workflow file, which prevents the workflow from accessing the necessary resources, such as repository contents or actions.
  • Reason 2: An edge case cause of this error is when a workflow is trying to access a repository or organization that has restrictive permissions or access controls in place, such as IP allowlisting or SAML single sign-on, which can block the workflow’s ability to authenticate and access the required resources.
  • Impact: The “Permission Denied” error can cause CI/CD pipelines to fail, resulting in delayed or failed deployments, and can also lead to security vulnerabilities if sensitive data is exposed due to incorrect permissions.

Step-by-Step Solutions

Method 1: The Quick Fix

  1. Go to Repository settings > Actions > General
  2. Toggle Enable workflows to access repository tokens to On
  3. Refresh the page and re-run the workflow.

Method 2: The Command Line/Advanced Fix

To fix the “Permission Denied” error using the command line, you can update the workflow file to include the necessary permissions block. For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
name: My Workflow
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        permissions:
          contents: read
          actions: read

This will grant the workflow the necessary permissions to access the repository contents and actions.

Prevention: How to Stop This Coming Back

To prevent the “Permission Denied” error from occurring in the future, it’s best to follow these best practices:

  • Always include a permissions block in your workflow file with the necessary permissions.
  • Use the actions/checkout step with the permissions block to ensure that the workflow has access to the repository contents.
  • Monitor your workflow runs and adjust the permissions as needed to ensure that the workflow has the necessary access to resources.

If You Can’t Fix It…

[!WARNING] If GitHub Actions keeps crashing due to the “Permission Denied” error, consider switching to CircleCI which handles secrets configuration and permissions natively without these errors.

FAQ

Q: Will I lose data fixing this? A: No, fixing the “Permission Denied” error should not result in any data loss, as it only involves updating the workflow configuration and permissions.

Q: Is this a bug in GitHub Actions? A: The “Permission Denied” error is not a bug in GitHub Actions, but rather a result of incorrect or missing permissions configuration. GitHub Actions has undergone several updates to improve permissions handling, including the introduction of the permissions block in workflow files, which was added in version 2.287.0 of the GitHub Actions runner.


📚 Continue Learning

Check out our guides on GitHub Actions and Permission Denied.