Lesstep
Azure Pipelines · checkout · Checked November 6, 2026

Azure Pipelines: "Git fetch failed with exit code: 128"

The checkout step runs git fetch on the agent. When it fails, the agent waits 1 to 10 seconds and tries again, three tries in all, and then stops with this line (from the agent's source). 128 is the exit code git uses for any fatal error, so the line says nothing about the cause. The cause is in what git printed just before it: scroll up to the first remote: or fatal: line, and find it below (a Stack Overflow question on this message has been seen over 97,000 times).

When the failing build is a pull request's build validation, the pull request waits on it: Azure DevOps Pull Requests, a plugin for JetBrains IDEs, lists the pull request's branch policies with their state in your IDE, and with Pro runs a failed build policy again once checkout works. Get it on JetBrains Marketplace

What it looks like

remote: TF401019, or repository not found: the build service may not read it

fatal: Authentication failed, or could not read Username

A pull request build whose pull request is no longer active

A self-hosted agent: an extraheader left in git's global config

The agent cannot reach the server

Git checkout failed with exit code: 128 on a shallow fetch

Azure DevOps pull requests in IntelliJ IDEA and Rider

Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, reads the organization, project and repository from your git remote and lists the pull requests that wait for your review in an IDE tool window, on Azure DevOps Services and on Azure DevOps Server. It shows the branch policies of a pull request with their state, so a required build that has not passed is next to its pull request, and with Pro you run a failed or expired build policy again from there. The review inbox is free; voting, commenting, completing and creating are Pro, with a 30-day trial.

Get it on JetBrains Marketplace

Azure DevOps and Azure Pipelines are trademarks of Microsoft Corporation; IntelliJ IDEA and Rider are trademarks of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft or JetBrains.

More: TF401019: the repository does not exist or you may not read it · git had no token to send · the token was refused · 日本語