我试图使用go get -u <github_private_repo_link>
从私有存储库中获取一些依赖项,但它一直失败,并出现以下错误:
server response:
not found: github.com/..../v3@v3.11.1: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/168bff8af96cdfac9cbe3ad64f7753732f8a19d99f7f1e897f19371e1ea453d9: 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.
我已经尝试导出set GIT_TERMINAL_PROMPT=1
,但没有发生任何事情,发出相同的错误。有没有什么办法去得到将忽略此变量的值在windows上的go 1.13
?
1条答案
按热度按时间whhtz7ly1#
尝试为GitHub设置临时凭证处理程序:
或者安装github cli并使用
gh auth login
进行github认证。并查看错误消息中提到的文档以获取其他选项:
Git可以配置为通过HTTPS进行身份验证,或者使用SSH代替HTTPS。要通过HTTPS进行身份验证,可以在git查询的
$HOME/.netrc
文件中添加一行:对于GitHub帐户,密码可以是个人访问令牌。
Git也可以配置为使用SSH代替HTTPS来匹配给定前缀的URL。例如,要对所有GitHub访问使用SSH,请将以下行添加到
~/.gitconfig
: