英文:
go get accept selfsigned certificate from distant host
问题
我想要能够使用一个友好的URL从我的Stash服务器上进行go get
操作。我的Stash服务器只支持HTTPS。问题是,我在Stash上使用的SSL证书是自签名的,因此对我的服务器进行任何go get
操作都会出现以下错误:
x509: certificate signed by unknown authority
有没有办法在go get
中授权自签名证书?
英文:
I'd like to be able to go get
from my Stash server with a nice URL. My stash server works only over HTTPS. The problem is that my SSL certificate I'm using with stash is self-signed and any go get
to my server gets me the following error:
x509: certificate signed by unknown authority
Is there a way to authorize self-signed certificates from go get
?
答案1
得分: 10
go get -insecure
已被弃用。
从go 1.14开始,正确的方法是通过将GOINSECURE
环境变量设置为一个逗号分隔的域名列表,用于忽略证书。
例如,在~/.zshrc
中设置(如果使用zsh shell):
GOINSECURE=example.com
然后,您就可以像这样安装包:
go get example.com/some/pkg
英文:
go get -insecure
has been deprecated.
As of go 1.14, the correct way to do this is by setting the GOINSECURE
environment variable to a comma-separated list of domains from which you'd like to ignore the certs.
E.g. Setting in within ~/.zshrc
(if zsh shell)
GOINSECURE=example.com
Then you will be able to install the packages like:
go get example.com/some/pkg
答案2
得分: 5
使用 go get -insecure https://xxxxx
命令。
根据 go get -h
的说明:
-insecure
标志允许从仓库获取和解析使用不安全协议(如HTTP)的自定义域名。请谨慎使用。
英文:
Use go get -insecure https://xxxxx
.
From go get -h
:
> The -insecure flag permits fetching from repositories and resolving
custom domains using insecure schemes such as HTTP. Use with caution.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论