为了账号安全,请及时绑定邮箱和手机立即绑定

GoLand 导入 go 模块公共存储库失败,版本无效

GoLand 导入 go 模块公共存储库失败,版本无效

Go
噜噜哒 2023-08-21 14:46:07
我想将我创建的模块导入到另一个项目中。源代码位于 GitHub 的公共存储库中,但在尝试导入 GoLand 时出现以下错误:go: finding module for package github.com/ambye85/gophercises/linkgo: downloading github.com/ambye85/gophercises/link v0.0.0-20200323082040-d484a876f7e8go: downloading github.com/ambye85/gophercises v0.0.0-20200323082040-d484a876f7e8github.com/ambye85/gophercises/sitemap imports    github.com/ambye85/gophercises/link: github.com/ambye85/gophercises/link@v0.0.0-20200323082040-d484a876f7e8: verifying module: github.com/ambye85/gophercises/link@v0.0.0-20200323082040-d484a876f7e8: reading https://sum.golang.org/lookup/github.com/ambye85/gophercises/link@v0.0.0-20200323082040-d484a876f7e8: 410 Gone    server response:    not found: github.com/ambye85/gophercises/link@v0.0.0-20200323082040-d484a876f7e8: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /tmp/gopath/pkg/mod/cache/vcs/a488fe783593bd6e7b765f40dfed37c7e534d0a80ca8e1bff63e11e21f02e8fd: exit status 128:        fatal: could not read Username for 'https://github.com': terminal prompts disabled我所做的所有搜索似乎都表明这是由于尝试访问私人存储库引起的。这里情况不同。有谁知道原因和解决方法是什么?输出go env:go envGO111MODULE=""GOARCH="amd64"GOBIN=""GOCACHE="/Users/ashleyb/Library/Caches/go-build"GOENV="/Users/ashleyb/Library/Application Support/go/env"GOEXE=""GOFLAGS=""GOHOSTARCH="amd64"GOHOSTOS="darwin"GOINSECURE=""GONOPROXY=""GONOSUMDB=""GOOS="darwin"GOPATH="/Users/ashleyb/go"GOPRIVATE=""GOPROXY="https://proxy.golang.org,direct"GOROOT="/usr/local/Cellar/go/1.14/libexec"GOSUMDB="sum.golang.org"GOTMPDIR=""GOTOOLDIR="/usr/local/Cellar/go/1.14/libexec/pkg/tool/darwin_amd64"GCCGO="gccgo"AR="ar"CC="clang"CXX="clang++"CGO_ENABLED="1"GOMOD=""CGO_CFLAGS="-g -O2"CGO_CPPFLAGS=""CGO_CXXFLAGS="-g -O2"CGO_FFLAGS="-g -O2"CGO_LDFLAGS="-g -O2"PKG_CONFIG="pkg-config"
查看完整描述

1 回答

?
森林海

TA贡献2011条经验 获得超2个赞

可以使用以下方法修复:

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

当您尝试进行身份验证https但已启用 2FA 时,可能会出现此问题。ssh这可以通过强制 git 用于所有交互来解决。

查看完整回答
反对 回复 2023-08-21
  • 1 回答
  • 0 关注
  • 73 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信