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/"

  

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