go get 下载 gitlab 私有项目

配置环境变量,不走proxy的host

GOPRIVATE=*.mygitlab.com
GONOPROXY=none

如果 mygitlab.com 不支持 https, 还得加上 -insecure 参数

$ go get -v  -insecure  mygitlab.com/user/repo 

协议转换

默认需要输入用户名和密码,比较繁琐。 由于 go get 底层实际还是用了 git 去操作。可以配置 .gitconfig 使之用 http => ssh 的访问方式

$ git config --global url."[email protected]:".insteadOf "http://mygitlab.com/"

  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章