How to use Go with a private GitLab repo

后端 未结 11 1672
时光说笑
时光说笑 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:47

    From dep version 5.2, dep supports private repositories for Gitlab private repositories.

    On .netrc file, you can provide your Gitlab username and access token for accessing private repositories.

    1. Create .netrc file in your $HOME directory
    $ touch $HOME/.netrc
    
    1. Edit your .netrc with your Gitlab credentials
    machine gitlab..com
    login 
    password 
    
    ... (more private repositories if needed)
    
    1. In your Go repository, run the dep command to resolve private packages. In this case,
    $ dep ensure -v
    

提交回复
热议问题