## 1. set env

  1 2 3 4 5 6 7 8 9 10 11  # Set the git address of the private repository go env -w GOPRIVATE="git@gitlab.xxx.cn" # Allow setting unsecured access to a repository that can be requested to an http address after configuration go env -w GOINSECURE="gitlab.xxx.cn" # Set the request to this address without a proxy, i.e. GOPROXY go env -w GONOPROXY="gitlab.xxx.cn" # Set not to verify the signature of sum packages go env -w GONOSUMDB="gitlab.xxx.cn" 

## 2. Configure the secret key

If the library to be pulled is private and the secret key needs to be configured, the following command can be used.

## 4. Configure .netrc

This step can be done by directly omitting steps 2 and 3 and using the .netrc file (file path: ~/.netrc), as follows

 1  machine gitlab.xxx.cn login password 

Using this step also solves a problem with gitlab where it fails to pull subgroups: Go get fails with the usage of subgroups. For example.

 1 2 3  # The following pull command will report an error if you don't use step 4 # Because of the limitations of gitlab, you can only pull up to one level, i.e. gitlab.xxx.cn/a/b.git \$ go get -u gitlab.xxx.cn/a/b/c.git