I assume before fetching golang private module, you already have put your public SSH key on your git repository.
$mkdirexample&&cdexample$go mod init examplego: creating new go.mod: module example# this is my private repo, this attempt will produce error$go get github.com/clavinjune/testing@latestgo get github.com/clavinjune/testing@latest: module github.com/clavinjune/testing: git ls-remote-q originin[redacted]:exitstatus 128: fatal: could notreadUsernamefor'https://github.com': terminal prompts disabledConfirm the import path was entered correctly.If this is a private repository, see https://golang.org/doc/faq#git_httpsforadditional information.# change the https to ssh, go get will try fetching your private module using your SSH key$git config--global--add url."git@github.com:".insteadOf"https://github.com/"$go get github.com/clavinjune/testing@latestgo get: added github.com/clavinjune/testing v1.0.0# success! But if above method still doesn't work set GOPRIVATE first$goenv-wGOPRIVATE="github.com/clavinjune/*"# then, go get again
Top comments(0)
Subscribe
For further actions, you may consider blocking this person and/orreporting abuse