How to use Go with a private GitLab repo

后端 未结 11 1671
时光说笑
时光说笑 2020-12-04 11:11

GitLab is a free, open-source way to host private .git repositories but it does not seem to work with Go. When you create a project it generates a URL of the fo

11条回答
  •  清歌不尽
    2020-12-04 11:53

    Run this command:

    git config --global url."git@1.2.3.4:".insteadOf "https://1.2.3.4/"
    

    Assuming you have the correct privileges to git clone the repository, this will make go get work for all repos on server 1.2.3.4.

    I tested this with go version 1.6.2, 1.8, and 1.9.1.

提交回复
热议问题