Skip to content
Sourcegraph Help Center home
Sourcegraph Help Center home

Troubleshooting 403 errors when Batch Changes fails to push

Problem

Batch Changes reports 403 / "You are not allowed to upload code" errors when attempting to push commits to a code host.

Cause

  • The credential configured for Batch Changes does not have write/push permissions on the target repository.

  • OAuth apps may be configured without the required API scope (GitLab requires the api scope).

Solution

  1. Use a credential with push access

    • Use a user account or service account that has write (push) permissions on the target repositories.

    • Preferred: create and use a Personal Access Token (PAT) with the required scopes.

  2. If using GitLab OAuth app, enable api scope

    • Ensure the OAuth app configuration includes api scope (for example: "apiScope": "api").

  3. Validate the credential in Site Settings → Batch Changes → Settings

    • Open Batch Changes settings, locate the code host credential and click the “Check” button to validate it.

  4. Retry the failing changeset

    • After fixing or replacing the credential, use the Retry option on the failed changeset so the push is attempted again.

Checklist

  • Was a PAT used? If yes, confirm it has appropriate scopes.

  • Does the account associated with the credential have write access to the repo?

  • Does the Batch Changes credential check show as valid?

  • If using OAuth, does it include the required API scope (GitLab: api)?

Further help

If you still see 403 errors after these steps, double-check repository-level permissions and consult your code host admin to verify there are no additional restrictions (IP allowlists, required approvals, or branch protections) preventing pushes.