Commit 00da5590 authored by Ethan Reesor's avatar Ethan Reesor

Refactor Go proxy documentation

parent 6a68ec20
...@@ -6,27 +6,48 @@ ...@@ -6,27 +6,48 @@
With the Go proxy for GitLab, every project in GitLab can be fetched with the With the Go proxy for GitLab, every project in GitLab can be fetched with the
[Go proxy protocol](https://proxy.golang.org/). [Go proxy protocol](https://proxy.golang.org/).
## Enable the Go proxy ## Prerequisites
NOTE: **Note:** ### Enable the Package Registry
This option is available only if your GitLab administrator has
[enabled support for the Package Registry](../../../administration/packages/index.md). **(PREMIUM ONLY)**
After the Package Registry is enabled, it will be available for all new projects
by default. To enable it for existing projects, or if you want to disable it:
1. Navigate to your project's **Settings > General > Permissions**. The Package Registry is enabled for new projects by default. If you cannot find
1. Find the Packages feature and enable or disable it. the **{package}** **Packages > List** entry under your project's sidebar, verify
1. Click on **Save changes** for the changes to take effect. the following:
You should then be able to see the **Packages** section on the left sidebar. 1. Your GitLab administrator has [enabled support for the Package
Next, you must configure your development environment to use the Go proxy. Registry](../../../administration/packages/index.md). **(PREMIUM ONLY)**
1. The Package Registry is [enabled for your project](../index.md).
NOTE: **Note:** NOTE: **Note:**
GitLab does not display Go modules in the **Packages** section of a project. GitLab does not display Go modules in the **Packages** section of a project.
Only the Go proxy protocol is supported at this time, and only for modules on Only the Go proxy protocol is supported at this time, and only for modules on
GitLab. GitLab.
### Fetch modules from private projects
NOTE: **Note:**
`go` does not support transmitting credentials over insecure connections. The
steps below will only work if GitLab is configured for HTTPS.
GitLab's Go proxy implementation supports HTTP Basic authentication for personal
access tokens, in addition to the usual authentication mechanisms. To configure
Go to use HTTP Basic authentication, you must create a [personal access
token](../../profile/personal_access_tokens.md) with the `api` or `read_api`
scope and add it to [`~/.netrc`](https://ec.haxx.se/usingcurl/usingcurl-netrc):
```netrc
machine my-server
login my-user
password my-token
```
Replace `my-user` with your username and `my-token` with your personal access
token. The value of `my-server` should be `gitlab.com` or the URL of your GitLab
instance. You can optionally append a path to `my-server`, which will restrict
the scope that the credentials will be used for. For example, `machine
gitlab.com/my-group` will restrict the credentials to URLs starting with
`gitlab.com/my-group`.
## Add GitLab as a Go proxy ## Add GitLab as a Go proxy
NOTE: **Note:** NOTE: **Note:**
...@@ -63,31 +84,6 @@ source is hosted). ...@@ -63,31 +84,6 @@ source is hosted).
go env -w GOPROXY=https://gitlab.com/api/v4/projects/1234/packages/go,https://proxy.golang.org,direct go env -w GOPROXY=https://gitlab.com/api/v4/projects/1234/packages/go,https://proxy.golang.org,direct
``` ```
## Fetch modules from private projects
NOTE: **Note:**
`go` does not support transmitting credentials over insecure connections. The
steps below will only work if GitLab is configured for HTTPS.
GitLab's Go proxy implementation supports HTTP Basic authentication for personal
access tokens, in addition to the usual authentication mechanisms. To configure
Go to use HTTP Basic authentication, you must create a [personal access
token](../../profile/personal_access_tokens.md) with the `api` or `read_api`
scope and add it to [`~/.netrc`](https://ec.haxx.se/usingcurl/usingcurl-netrc):
```netrc
machine my-server
login my-user
password my-token
```
Replace `my-user` with your username and `my-token` with your personal access
token. The value of `my-server` should be `gitlab.com` or the URL of your GitLab
instance. You can optionally append a path to `my-server`, which will restrict
the scope that the credentials will be used for. For example, `machine
gitlab.com/my-group` will restrict the credentials to URLs starting with
`gitlab.com/my-group`.
## Release a module ## Release a module
Go modules and module versions are handled entirely with Git (or SVN, Mercurial, Go modules and module versions are handled entirely with Git (or SVN, Mercurial,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment