Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: private git repo shows "fatal: could not read Username: terminal prompts disabled" #26145

Closed
Naatan opened this issue Jun 29, 2018 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@Naatan
Copy link

Naatan commented Jun 29, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10.3 linux/amd64 vgo:2018-02-20.1

This is meaningless though as this number is exactly the same when doing a fresh vgo build from master, a bug in itself if you ask me.

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Arch Linux

GOARCH="amd64"
GOBIN="/home/nathanr/.go/bin"
GOCACHE="/home/nathanr/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/nathanr/.go"
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build266124150=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Ran go run foo.go on a file that relies on a package that is hosted by a private repository. I have full access to the private repository (git clone runs without prompts).

What did you expect to see?

Expected foo.go to run without issue

What did you see instead?

vgo: creating new go.mod: module github.com/foo
vgo: copying requirements from /home/nathanr/Downloads/cli/Gopkg.lock
vgo: converting /home/nathanr/Downloads/cli/Gopkg.lock: stat github.com/foo2@3202a6c2340e9f2a4d12488f713f775802f70b00: git fetch -f --depth=1 https://github.com/foo2 3202a6c2340e9f2a4d12488f713f775802f70b00 in /home/nathanr/.go/src/mod/cache/vcs/cf52c0b67175c259cd4f3aa0218158d0d841a412dbcb1a79c9d38349e3075c18: exit status 128:
        fatal: could not read Username for 'https://github.com': terminal prompts disabled

Repo names anonymised

Additional Information

I found this relevant issue:

#25590

Tried building vgo with the fix included but no dice, error remains the same.

@gopherbot gopherbot added this to the vgo milestone Jun 29, 2018
@bcmills
Copy link
Contributor

bcmills commented Jun 29, 2018

What vgo commit did you build from?

What happens if you attempt to go get the same repository with the ordinary go tool?

Are you using the credential helper?

@bcmills
Copy link
Contributor

bcmills commented Jun 29, 2018

git clone runs without prompts

Is that true for both HTTPS and SSH, or just one of the two?

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jun 29, 2018
@typeless
Copy link

typeless commented Jul 1, 2018

I happened to encounter a similar error message. It turned out that it's a typo in my import path.

vgo: resolving import "github.com/PuerkitioBio/goquery"                                               
vgo: import "github.com/PuerkitioBio/goquery": git ls-remote -q https://github.com/PuerkitioBio/goquery in /Users/mura/go/src/mod/cache/vcs/07f08583e403b0b6a20a20e9ad3cfc653e2cdb3124291642a1351c3b33c3a64
8: exit status 128:                                                                                   
        fatal: could not read Username for 'https://github.com': terminal prompts disabled 
           
 ~/w/mops  ⑂ master + ⇡11    git ls-remote -q https://github.com/PuerkitioBio/goquery in /Users/mura/go/src/mod/cache/vcs/07f08583e403b0b6a20a20e9ad3cfc653e2cdb3124291642a1351c3b33c3a648                
Username for 'https://github.com': typeless                                                           
Password for 'https://typeless@github.com':                                                           
remote: Repository not found.                             

@Naatan
Copy link
Author

Naatan commented Jul 2, 2018

Is that true for both HTTPS and SSH, or just one of the two?

Seems I had to run it with HTTPS. After I authed with HTTPS using git then I could run vgo without issue.

Imo the bug here is that vgo does not forward the prompt.

Edit: by the way even the workaround is not especially intuitive. One might argue "just auth using git and try again", but simply authenticating using git alone will not work around this issue. You first have to configure git to cache your credentials, only then can you first manually auth using git to work around the issue with vgo. Point being that if you know what to do it is relatively easily worked around, but it does not seem like a workflow you'd want to depend on with vgo.

@golang golang deleted a comment Jul 2, 2018
@rsc
Copy link
Contributor

rsc commented Jul 6, 2018

This is not an issue in vgo but in cmd/go itself (if you run "go get" instead of "vgo get" you should see the same behavior). It's not a new bug either - we've turned off the terminal prompts for quite a few releases. It would be great to have better output here but I don't think it's critical for Go 1.11.

To reproduce:

$ HOME=/tmp go get github.com/rsc/nonexist
# cd .; git clone https://github.com/rsc/nonexist /Users/rsc/src/github.com/rsc/nonexist
Cloning into '/Users/rsc/src/github.com/rsc/nonexist'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
package github.com/rsc/nonexist: exit status 128
$

@rsc rsc modified the milestones: vgo, Go1.12 Jul 6, 2018
@rsc rsc changed the title x/vgo: Private repos lead to "could not read Username" cmd/go: private git repo shows "fatal: could not read Username: terminal prompts disabled" Jul 6, 2018
@agnivade agnivade removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 10, 2018
@bcmills
Copy link
Contributor

bcmills commented Nov 15, 2018

It would be great to have better output here

That's #25982.

@bcmills bcmills closed this as completed Nov 15, 2018
@golang golang locked and limited conversation to collaborators Nov 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants