这是回应
not found: github.com/me/[email protected]: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/ea2baff0eaed39430ee011ad9a011101f13b668d5fcbd9dffdfa1e0a45422b40: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
我尝试添加一条记录~/.netrc
使用新创建的 GitHub 个人访问令牌的密码并添加配置~/.gitconfig
[url "ssh://[email protected]/"]
insteadOf = https://github.com/
所有这些都不起作用。
如果我禁用总和检查GOSUMDB=off go mod tidy
然后它就起作用了,但我认为这对我来说不正确。
正如你的错误所说
无法读取用户名
所以,你应该改变~/.gitconfig
:
改变这个:
[url "ssh://[email protected]/"]
insteadOf = https://github.com/
to this:
[url "https://{{username}}:{{access_toke}}@github.com"]
insteadOf = https://github.com
另外,你需要~/.netrc
文件,内容如下:
machine github.com login {{username}} password {{access_token}}
P.S:您应该知道您的私有存储库应该位于您的GOPRIVATE=__YOUR_DOMAIN__
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)