或者是如下报错
fatal: could not read Username for 'https://xxx': 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.
一般是由于修改密码引起的,只需要重新输入密码就行。
cat ~/.gitconfig
把里面除了[user]下面的东西都删除,然后git clone一下私有库的代码(https方式),随便公司哪个项目。
会让你重新输入用户名密码,按照提示输完就行。
然后再执行go mod tidy。
一般go mod是通过https方式去下载依赖的,也可以通过改成ssh方式,则只要配置了ssh,就不需要输入密码。
还有一种方式就是移除本地的ssh秘钥,git pull拉取代码,触发输入账号密码就行。