go mod tidy
错误如下:
fatal: Cannot prompt because user interactivity has been disabled.
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://git.xxx.com/iot/kafka_wrapper.git/'
...
fatal: Cannot prompt because user interactivity has been disabled.
remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP.
remote: You can generate one at https://git.querycap.com/-/profile/personal_access_tokens
fatal: Authentication failed for 'https://git.xxx.com/iot/kafka_wrapper.git/'
1.对比排错
config
git config --global --list
githubhttpsgithubhttpsssh
git config --global url."git@github.com:".insteadOf "https://github.com/"
git config --global url."git@git.xxx.com:".insteadOf "https://git.xxx.com/"
2.补充
github
git config --global url."git@github.com:golang/".insteadOf "https://go.googlesource.com/"
3.扩展
通常我们会对go进行配置国内的镜像:
export GOPROXY=https://goproxy.cn,direct
export GOSUMDB=sum.golang.google.cn
export GOPRIVATE=git.xxx.com
go env -w GOPROXY=https://goproxy.cn,direct
go env -w GOSUMDB=sum.golang.google.cn
go env -w GOPRIVATE=git.xxx.com
3.1 GOPRIVATE
goproxy.cnGOPRIVATEproxy server
3.2 GOSUMDB
go.modgo.sumgo.sum
GONOSUMDBGONOSUMDBGOPRIVATE