GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — plumbing: transport/http, Expose typed auth error for Azure DevOps /_signin redirects by jfjrh2014 · Pull Request #2201 · go-git/go-git

Conversation

@jfjrh2014

@jfjrh2014 jfjrh2014 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Azure DevOps redirects unauthenticated requests for private repositories from /info/refs to /_signin. go-git previously surfaced this as a generic redirect error:

http transport: redirect target "/_signin" does not end with /info/refs

That made it impossible for callers to distinguish auth-required from a real transport failure without string-matching the error message.

This change detects a redirect target ending with /_signin and wraps the returned error with transport.ErrAuthenticationRequired, so callers can use:

errors.Is(err, transport.ErrAuthenticationRequired)

As noted by @pjbgf in #2200, we already have forge-specific logic for SSH failures, so adding an equivalent for the Azure DevOps HTTP redirect is consistent.

Closes #2200

Changes

  • plumbing/transport/http/common.go: Add /_signin detection in applyRedirect, wrapping the error with transport.ErrAuthenticationRequired.
  • plumbing/transport/http/common_test.go: Add table-driven test case for the Azure DevOps /_signin redirect, asserting errors.Is(err, transport.ErrAuthenticationRequired).

Verification

Added test case in the existing TestApplyRedirect table. Couldn't run go test locally (repo requires Go 1.25, environment has 1.19), but the change follows the exact fmt.Errorf("%w: ...", transport.ErrAuthenticationRequired, ...) pattern already used in checkError for HTTP 401 responses.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jfjrh2014
transport/http: expose typed auth error for Azure DevOps /_signin red…
d88bfcf
…irects

Azure DevOps redirects unauthenticated requests for private repos from
/info/refs to /_signin. go-git surfaced this as a generic redirect error,
making it impossible for callers to distinguish auth-required from a
real transport failure without string-matching.

When the redirect target ends with /_signin, wrap the error with
transport.ErrAuthenticationRequired so callers can detect it via
errors.Is(err, transport.ErrAuthenticationRequired).

Closes go-git#2200

Signed-off-by: jeff <[email protected]>
@pjbgf
pjbgf changed the base branch from master to main June 23, 2026 12:57
@pjbgf pjbgf changed the title transport/http: expose typed auth error for Azure DevOps /_signin redirects plumbing: transport/http, Expose typed auth error for Azure DevOps /_signin redirects Jun 23, 2026
pjbgf
pjbgf approved these changes Jun 23, 2026
View reviewed changes

@pjbgf pjbgf left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jfjrh2014 thanks for following up on this issue. 🙇

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pjbgf
pjbgf merged commit a3fc94e into go-git:main Jun 23, 2026
2 of 4 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pjbgf pjbgf pjbgf approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Expose typed auth error for Azure DevOps /_signin redirects

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@jfjrh2014 @pjbgf
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.