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 — Expose typed auth error for Azure DevOps `/_signin` redirects · Issue #2200 · go-git/go-git

Expose typed auth error for Azure DevOps /_signin redirects #2200

New issue
Copy link
New issue
Copy link
Closed
#2201
Closed
Expose typed auth error for Azure DevOps /_signin redirects#2200
#2201
Copy link
Labels
help wantedExtra attention is needed

Description

@grouville
grouville
opened on Jun 18, 2026
Issue body actions

What happened?

When listing refs for a private Azure DevOps repo without auth, Azure can redirect the smart HTTP refs request to /_signin.

go-git currently surfaces that as a plain redirect-shape error:

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

That makes it hard for callers to distinguish an auth-required private repo from an unexpected transport failure without string-matching the error.

This came up downstream in Dagger while probing whether a git remote is public: dagger/dagger#13516

The relevant go-git code on releases/v5.x still returns a plain fmt.Errorf here: https://github.com/go-git/go-git/blob/releases/v5.x/plumbing/transport/http/common.go#L370-L371

I also verified this locally against my private Azure Repos repository with github.com/go-git/go-git/v5 v5.19.1.

Reproduction

Create or use a private Azure Repos repository, then run this with its HTTPS clone URL:

mkdir /tmp/go-git-azure-signin-repro
cd /tmp/go-git-azure-signin-repro
go mod init azure-signin-repro
go get github.com/go-git/go-git/[email protected]

Create main.go:

package main

import (
	"context"
	"errors"
	"fmt"
	"os"

	"github.com/go-git/go-git/v5"
	"github.com/go-git/go-git/v5/config"
	"github.com/go-git/go-git/v5/plumbing/format/pktline"
	"github.com/go-git/go-git/v5/plumbing/transport"
	"github.com/go-git/go-git/v5/storage/memory"
)

func main() {
	remoteURL := os.Getenv("REMOTE_URL")
	if remoteURL == "" {
		fmt.Fprintln(os.Stderr, "REMOTE_URL is required")
		os.Exit(2)
	}

	repo := git.NewRemote(memory.NewStorage(), &config.RemoteConfig{
		Name: "origin",
		URLs: []string{remoteURL},
	})

	_, err := repo.ListContext(context.Background(), &git.ListOptions{Auth: nil})
	fmt.Printf("err: %v\n", err)
	fmt.Printf("is auth required: %v\n", errors.Is(err, transport.ErrAuthenticationRequired))
	fmt.Printf("is invalid pkt-len: %v\n", errors.Is(err, pktline.ErrInvalidPktLen))
}

Run:

REMOTE_URL='https://dev.azure.com/ORG/PROJECT/_git/REPO' go run .

Current output from my private repo:

err: http redirect: target "/_signin" does not end with /info/refs
is auth required: false
is invalid pkt-len: false

Expected behavior

It would be helpful if this case were classified as transport.ErrAuthenticationRequired, or otherwise exposed as a typed/sentinel error that callers can detect with errors.Is / errors.As.

Activity

  1. grouville
    changed the title [-]Expose typed auth error for Azure DevOps /_signin redirects[/-] [+]Expose typed auth error for Azure DevOps `/_signin` redirects[/+] on Jun 18, 2026
  2. pjbgf
    added
    help wantedExtra attention is needed
    on Jun 19, 2026
  3. pjbgf commented on Jun 19, 2026

    @pjbgf
    pjbgf
    on Jun 19, 2026
    Member
    More actions

    @grouville thanks for opening this issue.

    Generally, I rather not add forge-specific logic in go-git, although we already have some when it comes down to SSH failures. Happy for us to add an if in that code and if the path ends with _signin we return an error wrapping transport.ErrAuthenticationRequired.

  4. pjbgf
    added a commit that references this issue on Jun 23, 2026

    plumbing: transport/http, Expose typed auth error for Azure DevOps /_…

    This issue will close once commit a3fc94e is merged into the 'main' branch.
    a3fc94e
  5. pjbgf
    closed this as completedin #2201on Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.