Thanks for reaching out to Microsoft Q&A.
This redirect-to-signin behavior usually means your self-hosted agent’s Git client isn’t actually honoring the OAuth token header that Azure Pipelines injects for non-interactive HTTPS checkouts. Instead Git falls back to an interactive login flow (hence the redirect).
Here's why it happens and what you can try:
- Git version / preference on self-hosted agents
- On Microsoft-hosted Windows agents, we bundle and use a Git build that fully supports the
-c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)"trick Azure Pipelines uses for checkouts. - On self-hosted (and on any non-Windows agent), the agent defaults to whatever
gitis in your PATH (viaSystem.PreferGitFromPath=true). If that Git is too old or was built without full HTTP header/TLS support, it will ignore the extraheader and Git HTTPS ends up prompting you to sign in.
- On Microsoft-hosted Windows agents, we bundle and use a Git build that fully supports the
- Proxy or TLS interception
- If you’re behind a corporate proxy that interrupts or replaces TLS connections, you may actually be getting your internal proxy’s login page instead of the real Azure DevOps JSON response. In that scenario Git sees HTML and tries to launch an interactive sign-in.
- “Allow scripts to access OAuth token” must be on
- In your pipeline settings you need Allow scripts to access the OAuth token enabled so that
$(System.AccessToken)is available during checkout.
- In your pipeline settings you need Allow scripts to access the OAuth token enabled so that
Try below steps:
Check which Git your agent is using:
- Run
git --versionon the agent machine- Look in the agent logs to see the Git path
If it’s an older or custom Git, either:
- Install a newer Git (2.21+ with full HTTPS & extraheader support) in your PATH
- Or force the agent to use its bundled Git by setting
System.PreferGitFromPath=falsein the pipeline or environment
- Or force the agent to use its bundled Git by setting
Verify your network/proxy:
- Ensure direct TLS to
dev.azure.com(or your Azure DevOps domain) works, without corporate intercepts- If you must use a proxy, set
http_proxy/https_proxyenv vars for Git and confirm it doesn’t inject HTML sign-in flows
- If you must use a proxy, set
Double-check pipeline security:
- In the YAML or pipeline UI, make sure Allow scripts to access the OAuth token is turned on.
Hope this helps!
If the resolution was helpful, kindly take a moment to click on and click on Yes for was this answer helpful. And, if you have any further query do let us know.