远程错误:tls:使用go get拒绝访问

时间:2018-11-19 07:52:37

标签: git go github

我无法使用go get下载k8s.io/client-go/...,但是可以下载github.com/nsf/gocode之类的其他文件。

所以我认为我关于git和go的配置是正确的。
我不知道为什么会这样?

有什么解决办法吗?

$ git version
git version 2.19.1.windows.1

$ go version
go version go1.11.2 windows/amd64

$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\zhongtao\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\zhongtao\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Software\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Software\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\zhongtao\AppData\LoTemp\go-build041230430=/tmp/go-build -gno-record-gcc-switches

$ go get -u -v github.com/nsf/gocode
github.com/nsf/gocode (download)
github.com/nsf/gocode

$ go get -u -v k8s.io/client-go/...
Fetching https://k8s.io/client-go?go-get=1
https fetch failed: Get https://k8s.io/client-go?go-get=1: remote error: tls: access denied
package k8s.io/client-go/...: unrecognized import path "k8s.io/client-go/..." (https fetch: Get https://k8s.io/client-go?go-get=1: remote r: tls: access denied)

2 个答案:

答案 0 :(得分:1)

通过“导出http_proxy = *****”修复

答案 1 :(得分:0)

据我了解,您需要让git使用特定版本的ssl,

sslVersion = tlsv1.2

可处理tls问题。

以下命令应有所帮助:

git config --global --add htttp.sslVersion tlsv1.2