How to use Go with a private GitLab repo

后端 未结 11 1652
时光说笑
时光说笑 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 12:06

    The way I usually do it is:

    Ensure you are using SSH.

    once that's done you can configure your git to use ssh instead https

    If you are using Mac OX. you can run vim ~/.gitconfig and add

    [url "git@gitlab.com:"]
    insteadOf = https://gitlab.com/
    

    once configured you can run

    GOPRIVATE="gitlab.com/your_username_or_group" go get gitlab.com/name_or_group/repo_name
    

    I hope that helps.

提交回复
热议问题