go 拉取仓库依赖报错:fatal: could not read Username for ‘https:code.byted.org‘: terminal prompts disabled

go 拉取仓库依赖报错:fatal: could not read Username for ‘https:code.byted.org‘: terminal prompts disabled,第1张

文章目录 解决方法

在我们用 go mod tidy更新项目依赖包的时候,有可能会遇到这个问题,这个主要问题是git没有配置的问题。

解决方法

在控制台输入以下命令,这个主要是配置我们拉取依赖源是哪一个,添加相应的仓库源

vim ~/.gitconfig
[user]
        email = email
        name = name
[url "git@github.com/:"]
 insteadOf = https://github.com/"

还有一种是将ssh替代成https的方式

git config --global --add url."git@github.com:".insteadOf "https://github.com/"

参考文档:
https://medium.com/easyread/today-i-learned-fix-go-get-private-repository-return-error-terminal-prompts-disabled-8c5549d89045
https://stackoverflow.com/questions/32232655/go-get-results-in-terminal-prompts-disabled-error-for-github-private-repo

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/995372.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存