git-ecosystem / git-ecosystem/git-credential-manager

GCM won't work for go repo with private modules

Open
#1,563 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auth-issue
Dominant language
C#
Stars
9.3k
Forks
2.9k
Avg merge
7d 1h
Merged PRs (30d)
14

Description

Version

2.4.1

Operating system

Linux

OS version or distribution

Ubuntu 22.04

Git hosting provider(s)

Azure DevOps, GitHub

Other hosting provider

No response

(Azure DevOps only) What format is your remote URL?

https://{org}.visualstudio.com

Can you access the remote repository directly in the browser?

Yes, I can access the repository

Expected behavior

I've been using ssh key on linux (note: ssh won't work on windows with go get command), after configured git url.insteadOf, GOPRIVATE, etc, I can use git clone and go get.

I would expect GCM behave the same as SSH.

Actual behavior
  1. configured GOPRIVATE to include private repo (i.e. orgname.visualstudio.com/orgname/*)
  2. configured git to use credentialType=oauth and credentialStore=gpg
 [credential]
       helper = /usr/local/bin/git-credential-manager
       azreposCredentialType = oauth
       credentialStore = gpg
  1. go get won't authenticate against private repo
GIT_TRACE=1 go get -v orgname.visualstudio.com/orgname/projname/reponame.git/api@v0.0.39
# cd /home/xd/goroot/pkg/mod; git ls-remote https://orgname.visualstudio.com/orgname/projname/reponame
23:11:09.952938 git.c:455               trace: built-in: git ls-remote https://orgname.visualstudio.com/orgname/projname/reponame
23:11:09.953007 run-command.c:668       trace: run_command: git remote-https https://orgname.visualstudio.com/orgname/projname/reponame https://orgname.visualstudio.com/orgname/projname/reponame
23:11:09.955273 git.c:742               trace: exec: git-remote-https https://orgname.visualstudio.com/orgname/projname/reponame https://orgname.visualstudio.com/orgname/projname/reponame
23:11:09.955312 run-command.c:668       trace: run_command: git-remote-https https://orgname.visualstudio.com/orgname/projname/reponame https://orgname.visualstudio.com/orgname/projname/reponame
fatal: repository 'https://orgname.visualstudio.com/orgname/projname/reponame/' not found
  1. i can use git to access dependent repo
Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the go get command with the shown GOPRIVATE, Git credential settings, and GIT_TRACE=1, then compare it with direct Git access to the Azure DevOps repository. Trace how GCM handles the private-module URL and OAuth credentials; done means go get can authenticate and fetch the dependent private repository.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, git, go
Domain
authentication, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.