Chanonry
Chanonry

Reputation: 443

golang import github private repo

Completely confused.

go 1.13.5 using modules

I am trying to import a private repo from github. Searching is increasing the confusion not reducing it. I have tried a number of approaches including the keychain helper but I am going nowhere fast.

SSH is enabled and when tested establishes a connection successfully

My global gitconfig in C:/Users/me :

[user]
    name = xxxxxxx
    email = [email protected]
[core]
    autocrlf = input
[alias]
    st = status
[url "ssh://[email protected]/"]
    insteadOf = https://github.com/

go get github.com/user/repo@master produces

go: finding github.com master
go: finding github.com/user master
go: finding github.com/user/repo master
go: finding github.com/user/repo master
go: downloading github.com/user/repo v0.0.0-20191211180807-ee1bcd94c84f
verifying github.com/user/[email protected]: 
github.com/user/[email protected]: reading 
https://sum.golang.org/lookup/github.com/!user/[email protected]    
ee1bcd94c84f:410 Gone

The link yields :

not found: github.com/user/[email protected]: invalid version: git 
fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in/tmp/gopath/pkg/mod/cache/vcs/9524fc42cfd4910346f55f112665f9a51df7c4b31085d50baa5e01453e55ca58: 
exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled

Doesn't matter what I do I get this "cannot read Username" but I thought it should be using SSH not HTTPS

What's going on??

Not feeling the love for Modules making my life easier so far...

Upvotes: 1

Views: 8131

Answers (1)

Chanonry
Chanonry

Reputation: 443

After more searching and much experimentation, the issue is with the checksum failing on download of a private repo as by definition there is no checksum defined.

This was buried within a chain of responses on Github. There is an open issue to improve the documentation. Good idea.

This worked for me:

GONOSUMDB=github.com/username/* 
go get github.com/username/repo

Upvotes: 7

Related Questions