解决go mod或go get时`x509: certificate signed by unknown authority`错误

一般go get私有仓库时会出现如下错误:

go: xxx@v0.0.0-20190918102752-bb51b27911ca: unrecognized import path "xxx" (https fetch: Get https://xxx?go-get=1: x509: certificate signed by unknown authority)

原因是go get的执行过程需要https证书,检查server端证书是未知CA签署的并报错。

  • 解决方法:
    go get -insecure xxx
    这样go get就会通过http协议去访问私库了。
posted @ 2019-09-26 10:29  YYRise  阅读(16997)  评论(0编辑  收藏  举报