We have an Azure DevOps pipeline which connects to a GitHub project. The pipeline is throwing the following exception: ‘Unable to resolve the reference ‘refs/heads/main”.

Reason and Fix:

  • The issue was caused by a policy change at the GitHub level : Reduce or eliminate PAT use.
  • We were using a Personal Access Token (PAT) to connect Azure DevOps to GitHub.
  • The PAT token was configured with a ‘No Expiry’ setting.
  • GitHub updated its policy to restrict access for PAT tokens with a lifetime exceeding 365 days.
  • To resolve the issue, we regenerated the PAT token.
  • The new PAT token was configured with an expiry of less than 365 days, as required by GitHub’s updated policy.

🙂

Advertisements
Advertisements

Leave a comment