Why am I seeing “Cannot access the repository – Request is unauthorized (401)” when connecting Git Provider?

Last updated: June 26, 2026

Context

You’re trying to access your Git repository or link Git to your builds and receive a 401 Unauthorized error such as: “Cannot access the repository. Request is unauthorized (401). Please check your credentials…”. You may also be unable to re-link GitHub in a new or existing application.

Answer

This error typically means the GitHub authorization token on your account is invalid or missing required permissions. Reconnecting your GitHub integration usually resolves it.

  1. In Codemagic, go to Teams > select your Team > Team integrations.

  2. Open GitHub/Gitlab/Bitbucket and click Disconnect.

  3. Click Connect (or Reconnect) to GitHub and complete the GitHub authorization flow:

    • Sign in to the correct Git Provider account.

    • Grant Codemagic the requested access (organizations and repositories).

    • If your organization restricts repository access, ensure the integration is allowed for the specific repository or set to “All repositories.”

  4. Return to your app in Codemagic and refresh the repository list. Try accessing the repository again.

If the issue persists, verify you have at least read access to the target repository in Git Provider, then repeat the reconnect steps.