无效的版本:git ls-remote -q origin

huangapple go评论88阅读模式
英文:

Invalid version: git ls-remote -q origin

问题

go mod download 报错信息如下:

无效的版本:git ls-remote -q origin in /home/user/go/pkg/mod/cache/vcs/48782783hhh8394928: 退出状态 128:
        远程:支持密码身份验证已于 2021813 日移除。
        远程:请参阅 https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls 了解当前推荐的身份验证模式的信息。
        致命:身份验证失败 for 'https://github.com/***/***/'

GO 版本信息如下:

GO 版本:1.20
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GONOPROXY="github.com/name/*"
GONOSUMDB="github.com/name/*"
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE="github.com/name/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build909459645=/tmp/go-build -gno-record-gcc-switches"

需要帮助吗?

英文:

go mod download giving:

invalid version: git ls-remote -q origin in /home/user/go/pkg/mod/cache/vcs/48782783hhh8394928: exit status 128:
        remote: Support for password authentication was removed on August 13, 2021.
        remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
        fatal: Authentication failed for 'https://github.com/***/***/'

GO version: 1.20

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GONOPROXY="github.com/name/*"
GONOSUMDB="github.com/name/*"
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE="github.com/name/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build909459645=/tmp/go-build -gno-record-gcc-switches"

Any help?

答案1

得分: 0

修改了 ~/.gitconfig 文件。

修改前:

insteadOf = https://github.com

修改后:

insteadOf = https://github.com/orgName
英文:

Changed the ~/.gitconfig file.

Before:

insteadOf = https://github.com

After change:

insteadOf = https://github.com/orgName

huangapple
  • 本文由 发表于 2023年7月8日 17:47:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76642310.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定