We have an Azure DevOps pipeline, and in one of the steps (see below), we trigger the git checkout command.

We began encountering the following fatal error.
fatal: 'origin/main' is not a commit and a branch 'main' cannot be created from it
Reason and Fix:
- We used a git PAT token to connect to Git from Azure DevOps and configured the Service Connection as shown below.

- The pipeline was configured to run using the Service Connection mentioned above.

- As for the error, it occurred due to an expired PAT token. Providing a valid PAT token and rerunning the pipeline resolved the issue.
🙂


Leave a comment