首先,虽然和下面的问题看起来一样
- How to fix git error: RPC failed; curl 56 GnuTLS
- git error:RPC failed,curl 56 GnuTLS recv error (-110) , 和
- "error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated" ,其中 Hovo Asatryan 评论说“它没有解决问题,我试过了”,我也试过了,但都不适合我。
不是。因为所有这些问题都在 git
上,但这是在 go get
上:
$ go get -v -u golang.org/x/tools/cmd/goimports
get "golang.org/x/tools/cmd/goimports": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at //golang.org/x/tools/cmd/goimports?go-get=1
get "golang.org/x/tools/cmd/goimports": verifying non-authoritative meta tag
golang.org/x/tools (download)
# cd .; git clone -- https://go.googlesource.com/tools /path/to/Go/src/golang.org/x/tools
Cloning into '.../Go/src/golang.org/x/tools'...
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.
package golang.org/x/tools/cmd/goimports: exit status 128
没有一个解决方案对我有用,我相信对典型公司开发环境中的任何人都适用:
- 我们在公司防火墙后面访问 Internet,因此除非经过特殊处理,否则任何安全的 https 访问都将失败。
- 除了像上面那样访问公共(public) https git 存储库,https://go.googlesource.com/tools ,这或多或少是一次性的,我们需要访问我们的内部 https TFS git 存储库一直。因此,我无法像其他解决方案建议的那样更改 git https 访问方法。
- 我尝试预先使用
git config --global http.sslVerify false
但问题仍然完全相同。
那么问题来了,我怎样才能让 go get
告诉 git
放宽它的安全检查?
我认为这是我唯一的选择,但我洗耳恭听。
附言。 -insecure
也不起作用:
$ go get -v -insecure golang.org/x/sys/unix
get "golang.org/x/sys/unix": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at //golang.org/x/sys/unix?go-get=1
get "golang.org/x/sys/unix": verifying non-authoritative meta tag
golang.org/x/sys (download)
# cd .; git clone -- https://go.googlesource.com/sys /path/to/Go/src/golang.org/x/sys
Cloning into '/path/to/Go/src/golang.org/x/sys'...
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.
package golang.org/x/sys/unix: exit status 128
PPS。 curl -s https://go.googlesource.com/sys
对我来说效果很好:
$ curl -s https://go.googlesource.com/sys
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>sys - Git at Google</title><link rel="stylesheet" . . .
最佳答案
我只是在这上面花了太多时间。 F*ing ZScaller。 最终对我有用的是从 WSL 版本的 go(我认为是 Ubuntu 20 go 1.13)切换到最新版本(1.17.3)
我使用了以下链接的组合来实现这一点,可能存在更好的方法:
https://gist.github.com/nikhita/432436d570b89cab172dcf2894465753
https://askubuntu.com/questions/720260/updating-golang-on-ubuntu
但以防万一像我这样的菜鸟来到这里:
sudo apt-get purge golang*
curl -k https://dl.google.com/go/go1.17.3.linux-amd64.tar.gz --output go1.17.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf ./go1.17.3.linux-amd64.tar.gz
GOPATH=~/go
GOROOT=/usr/local/go
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
go install package@latest
success. FUZ (F U ZScaller)
关于git - 在公司防火墙后面如何让 go get 为 golang.org 工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66861682/