---
updatedAt: 2026-02-08T09:17:41.000Z
agentTools:
  siteIndex: https://docs.jfrog.com/llms.txt
  projectIndex: https://docs.jfrog.com/artifactory/llms.txt
---

# Go Modules

JFrog Artifactory offers support for Go modules, providing:

* Secure, private repositories with fine-grained access control over Go modules according to projects or development teams.
* Remote Go repositories, which provide <Anchor label="proxy and caching" title="Remote Repositories" href="/docs/remote-repositories">proxy and caching</Anchor> functionality for remote Go resources.
* Enterprise features such as high availability, repository replication for multi-site development and different options for massive scalability storage.
* A full solution with JFrog CLI, allowing you to resolve and publish your Go projects.
  <Image border={false} src="https://files.readme.io/d9880780abeafc4a9aea3606e0ceacceef2548a6130c03ba9f487b8648ae7b10-uuid-14c426d6-304b-3131-6396-337d11d2b9dd.png" />

For more information on the benefits of integrating Go with Artifactory, see the <Anchor label="integration benefits" target="_blank" href="https://jfrog.com/integrations/go-registry/">integration benefits</Anchor>.

# Get Started with Go

To get started working with Go, complete the following main steps:

1. [Create a Go Repository in Artifactory](#create-a-go-repository-in-artifactory)
2. [Connect your Go Client to Artifactory](#connect-your-go-client-to-artifactory)
3. [Deploy Go Modules to Artifactory](#deploy-go-modules-to-artifactory)
4. [Resolve Go Modules from Artifactory](#resolve-go-modules-from-artifactory)
   <Image border={false} src="https://files.readme.io/d8edd49b0a499571653a0867cd7a89f5ec7d01e21b20add7a71203c167debf2e-uuid-443b119f-cdcb-b8f6-75aa-1c93bacffdba.png" />

# Create a Go Repository in Artifactory

This topic describes how to create a Go repository in Artifactory. This is required before deploying and resolving Go modules. There are three primary types of repositories:

* **Local repositories**: Where you store and share 1st and 2nd party Go modules with your organization
* **Remote repositories**: Enable you to download from any remote location, including external package registries or other Artifactory instances
* **Virtual repositories**: Enable aggregating remote and local repositories, enabling your organization to scale by providing a single URL that provides access to multiple repositories and types

For more information on JFrog repositories, see [Repository Management](https://docs.jfrog.com/artifactory/docs/repository-management).

**Prerequisite**: You need Admin or Project Admin permissions to create a Go repository. If you don't have Admin permissions, the option will not be available.

**To create a Go repository**:

1. In the **Administration** tab, click **Repositories | Create a Repository**

   <Image alt="CreateAnsibleLocal1.png" border={false} src="https://files.readme.io/09424469efb2704cd6a30996aa14fea67ed9a1ae0de58a483dfc5642f7c7441b-uuid-a725dcbc-2348-a9c0-2c9d-a4d170827fe7.png" />
2. Select the repository type you want to create (local, remote, or virtual). The Select Package Type window opens.
3. Select **Go**.
4. In the New Repository window, configure the required fields (described in the following list).

   * For **Local Repositories**, In the **Repository Key** field, type a meaningful name for the repository. For example, `go-local-repo-1`. For more information on local repositories and their possible settings, see [Local Repositories](https://docs.jfrog.com/artifactory/docs/local-repositories).
   * For **Remote Repositories**, additionally verify the **Repository URL** and update it if needed. For more information related specifically to setting up remote Go repositories in Artifactory, see [Set Up Remote Go Repositories](#set-up-remote-go-repositories).

     For more general information on remote repositories and the relevant settings, see [Remote Repositories](https://docs.jfrog.com/artifactory/docs/remote-repositories).
   * For **Virtual Repositories**, additionally, select one or more local or remote repository types to include in the virtual repository. For more information on virtual repositories and the relevant settings, see [Virtual Repositories](https://docs.jfrog.com/artifactory/docs/virtual-repositories).
5. When you are finished configuring the repository, click **Create Repository**. The repository is created and the Repositories window is displayed.

# Connect your Go Client to Artifactory

This topic provides details on configuring your Go client to work with Artifactory. There are two methods for configuring your Go client with Artifactory:

* [Configure your native Go client with Artifactory](#configure-your-native-go-client-with-artifactory)
* [Configure your Go client with Artifactory using the JFrog CLI](#configure-your-go-client-with-artifactory-using-the-jfrog-cli)

**Pre-requisites**:

* Before connecting your Go client to Artifactory, you must have an existing Go repository in Artifactory. For more information , see [Create a Go Repository in Artifactory](#create-a-go-repository-in-artifactory).
* To deploy Go packages into an Artifactory repository, you first need to install and configure JFrog CLI. For more information on JFrog CLI and installation instructions, see [JFrog CLI](/integrations/docs/jfrog-cli).

**Supported Go Clients**

Artifactory requires Go client version 1.11.0 and above.

To install the Go client, please refer to the <Anchor label="Go Programming Language documentation" target="_blank" href="https://golang.org/doc/install">Go Programming Language documentation</Anchor>.

**Logged in vs. Anonymous User**: You can work with Artifactory as either a logged in user or as an anonymous user. To work with Artifactory using Anonymous Access. you need to configure that access under **Admin | Security | General**. For details, refer to [Allow Anonymous Access](/administration/docs/security-configuration#allow-anonymous-access).

## Configure your Go Client with Artifactory

To configure your native Go client to work with Artifactory:

1. If you want to use an identity token instead of your Artifactory password for configuring your Go client with Artifactory, follow the instructions in [Generate Scoped Tokens](/administration/docs/access-tokens#generate-scoped-tokens).

<Callout icon="📘" theme="info">
  **Note**

  JFrog recommends using an identity token for configuring your Go client, as it has certain advantages over a user password. However, it is not strictly required.
</Callout>

2. Set your default Artifactory Go repository by running the following command in the command line:

   ```
   export GOPROXY="https://<USERNAME>:<TOKEN>@<MY_JFROG_DOMAIN>/artifactory/api/go/<GO_REPO_NAME>"
   ```

   In the command above, replace the following placeholders as follows:

   * `<USERNAME>`: Replace with your username.
   * `<TOKEN>`: Replace with your identity token or Artifactory password.
   * `<MY_JFROG_DOMAIN>`: Replace with the name of your Artifactory domain.
   * `<GO_REPO_NAME>`: The name of your Go repository in Artifactory.

## Configure your Go Client with Artifactory Using the JFrog CLI

To configure your Go client to work with Artifactory using the JFrog CLI:

1. If you want to use an identity token instead of your Artifactory password for configuring your Go client with Artifactory, follow the instructions in [Generate Scoped Tokens](https://jfrog-enterprise-group.readme.io/administration/docs/access-tokens#generate-scoped-tokens).

<Callout icon="📘" theme="info">
  **Note**

  JFrog recommends using an identity token for configuring your Go client, as it has certain advantages over a user password. However, it is not strictly required.
</Callout>

2. Configure the Artifactory server details by running the following command in the JFrog CLI:

   ```
   jf c add rt-server --artifactory-url https://<MY_JFROG_DOMAIN>/artifactory --user <USERNAME> --password <TOKEN> --interactive=false
   ```

   In the command above, replace the following placeholders as follows:

   * `<USERNAME>`: Replace with your username.
   * `<MY_JFROG_DOMAIN>`: Replace with the name of your Artifactory domain.
   * `<TOKEN>`: Replace with your identity token or Artifactory password.
3. Configure the project with the Artifactory resolution repository.

   ```
   jf go-config --server-id-resolve rt-server --repo-resolve <GO_REPO_NAME>
   ```

   Where `<GO_REPO_NAME>` is the name of your Go repository in Artifactory.

<Callout icon="📘" theme="info">
  **Note**

  You can also use JFrog Set me up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](https://docs.jfrog.com/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).
</Callout>

**Next Steps**:

* [Deploy Go Modules to Artifactory](#deploy-go-modules-to-artifactory)
* [Resolve Go Modules from Artifactory](#resolve-go-modules-from-artifactory)

# Deploy Go Modules to Artifactory

The Go client works through a Git repository which hosts the Go module source code, and does not provide a way to directly deploy modules to Artifactory. To deploy your Go module to Artifactory, use the JFrog CLI.

<Callout icon="📘" theme="info">
  **Default Deployment Repository**

  If you are deploying Go modules to a Virtual Repository, make sure to set one of the local Go repositories that it aggregates as the [Default Deployment Repository](https://docs.jfrog.com/artifactory/docs/virtual-repositories).
</Callout>

To deploy a Go module to an Artifactory repository, you need to run the following JFrog CLI command from your project’s root directory:

```
jf gp <GO_REPO_NAME> <VERSION> --server-id rt-server
```

In the CLI command above, replace the placeholders as follows:

* `<GO_REPO_NAME>`: The name of your Go repository in Artifactory.
* `<VERSION>`: The version of the Go module that you are deploying to Artifactory.

# Resolve Go Modules from Artifactory

There are two methods for resolving Go modules from Artifactory:

* Using the Go client
* Using JFrog CLI

<Callout icon="📘" theme="info">
  **Resolving Go modules only via local or virtual repositories**

  Artifactory only supports resolution of Go modules from local or virtual Go repositories. To resolve Go modules from remote Go repositories, you need to aggregate them in a virtual Go repository.
</Callout>

## Resolve Go Modules Using the Go Client

To resolve Go modules from your Go repository in Artifactory using the Go client, run the following command from your project’s root directory:

```
go build
```

## Resolve Go Modules Using the JFrog CLI

To resolve Go modules using the JFrog CLI, run the following command under your project’s root directory:

```
jfrog rt go build
```

# Additional Go Actions

The following additional actions are available with Go repositories in Artifactory:

* [Set Up Remote Go Repositories](#set-up-remote-go-repositories), including information on how to [set up Go repositories to proxy private registries](#set-up-go-repositories-to-proxy-private-registries).
* [Advanced Configuration for Virtual Go Repositories](#advanced-configuration-for-virtual-go-repositories)
* [Resolving GitLab Subgroups](#resolving-gitlab-subgroups)

## Set Up Remote Go Repositories

<Callout icon="❗️" theme="error">
  **Important**

  To resolve dependencies from a remote Go repository, you must nest the remote repository under a virtual Go repository.
</Callout>

A remote Go repository in Artifactory serves as a caching proxy for <Anchor label="golang.org" target="_blank" href="https://proxy.golang.org/">golang.org</Anchor>, <Anchor label="GitHub.com" target="_blank" href="https://github.com/">GitHub.com</Anchor> or a Go repository in a different Artifactory instance.

Artifacts (such as zip files) requested from a remote Go registry are cached on demand. You can remove downloaded artifacts from the remote repository cache, however you can not manually deploy artifacts to a remote repository.

### Set Up Go Repositories to Proxy Private Registries

Starting from Artifactory version 7.77, It is possible to use remote Go repositories to proxy your private registries hosted on platforms such as:

* [GitHub](#proxy-github-with-go) (Cloud)
* [GitHub Enterprise](#proxy-github-enterprise-with-go) (Self-Hosted)
* <Anchor label="Bitbucket Cloud" title="Proxy Bitbucket Cloud with Go" href="#proxy-bitbucket-cloud-with-go">Bitbucket Cloud</Anchor> (Cloud)
* <Anchor label="Bitbucket Server" title="Proxy Bitbucket Server with Go" href="#proxy-bitbucket-server-with-go">Bitbucket Server</Anchor> (Self-Hosted)
* <Anchor label="GitLab" title="Proxy GitLab with Go" href="#proxy-gitlab-with-go">GitLab</Anchor> (Cloud & Self-Hosted)

<Callout icon="❗️" theme="error">
  **Important**

  Before using a Go repository to proxy a private registry, ensure your repository follows the <Anchor label="Go Modules Reference" target="_blank" href="https://go.dev/ref/mod">Go Modules Reference</Anchor>, and especially the <Anchor label="Module release and versioning workflow" target="_blank" href="https://go.dev/doc/modules/release-workflow">Module release and versioning workflow</Anchor>.
</Callout>

#### Set Up Go Proxy Mirror Repositories

When configuring Artifactory to proxy a private registry, it is highly recommended to always create a proxy mirror directing to <Anchor label="http://proxy.golang.org/" target="_blank" href="https://proxy.golang.org/"><http://proxy.golang.org/></Anchor> to resolve your public modules. This will reduce your unnecessary usage on your other remotes pointing to your private repositories hosted on other git providers and avoid potential rate-limiting issues.

To create a proxy mirror repository:

<Callout icon="📘" theme="info">
  **Note**

  When using a remote repository that implements Go API Specification, use Artifactory as the Git provider. For example, to set up a remote registry opposite `proxy.golang.org`, use Artifactory as the Git provider.
</Callout>

1. Create a new remote repository and set **Go** as its **Package Type.**
2. Set the **Repository Key** value, and enter <Anchor label="http://proxy.golang.org/" target="_blank" href="https://proxy.golang.org/"><http://proxy.golang.org/></Anchor> in the **URL** field.
3. In the **Go Settings** section, set the **Git Provider** as Artifactory.
4. In the **Advanced** tab, select the **Priority Resolution** checkbox.
5. Click **Save & Finish**.
6. Nest the repository you just created and your remote repository proxying a private registry under the same virtual repository. That way, whenever you resolve an artifact through the virtual repository, Artifactory will attempt to resolve your cached artifacts first and avoid requesting the external registry.

#### Proxy GitHub with Go

<Callout icon="❗️" theme="error">
  **Go Proxy Best Practice: Add Mirror Repository**

  JFrog highly recommends that you create a remote repository pointing to the default Go mirror (**proxy.golang.org**) and enter **Artifactory** as the **Git provider**. This way, Artifactory will be able to resolve cached public modules without querying the external registry, reducing the chance of rate limiting. For more information, see [Set Up Go Proxy Mirror Repositories](#set-up-go-proxy-mirror-repositories).
</Callout>

To create a Remote Repository which serves as a caching proxy for <Anchor label="github.com" target="_blank" href="https://github.com/">github.com</Anchor>, follow the steps below:

1. Create a new remote repository and set **Go** to be its **Package Type.**

2. Set the **Repository Key** value, and enter `https://github.com/` in the **URL** field as displayed below.

   <Image alt="Proxy_GitHub_with_Go.png" border={false} src="https://files.readme.io/18d14b1325a897c4775361be9d5124613e3abf8897e7a9f1f4969e0fe3782803-uuid-5e14b24c-774d-1d17-0f51-ddd1cc4f7de3.png" />

3. In the **Basic** tab, enter the username and password of your GitHub account. This is required due to a rate limit imposed by GitHub when access is anonymous.

<Callout icon="📘" theme="info">
  **From November 2020, GitHub no longer accepts account passwords when authenticating via the REST API**

  As per the latest GitHub update, basic authentication is no longer supported via REST API. Your password must be replaced with a GitHub private access token.
</Callout>

4. Scroll down to Go Settings and select **GitHub Cloud** for the Git Provider, as shown below.

   <Image alt="Proxy_GitHub_with_Go.png" border={false} src="https://files.readme.io/cc4e5d1ec719e742e915864227a96f199d7fa350f7626d14ee37a37b7b6346e0-uuid-9c500434-b4d4-a39d-a131-34d65d6686df.png" />
5. In the **Advanced** tab, check **[Lenient Host Authentication](https://docs.jfrog.com/artifactory/docs/remote-repositories#network-settings-for-remote-repositories)**.
6. Click **Save & Finish**.

##### Generate a Personal Access Token in GitHub Enterprise

This topic describes how to generate a personal access token in GitHub Enterprise that is needed for authentication when using a Go remote repository to [proxy your private GitHub Enterprise registry](#proxy-github-enterprise-with-go).

**To generate a personal access token in GitHub Enterprise**:

1. Log in to your GitHub Enterprise account.
2. Click your profile photo in the upper-right corner and select **User settings** from the menu.
3. From the sidebar menu on the left, click **Developer settings**.
4. Select **Personal access tokens > Tokens (classic)**.

   <Image alt="generate_PAT_in_GHE.png" border={false} src="https://files.readme.io/603b200d0e9f7cb48f72bccfc6e2c4c31f773110e4b8fc1858cafe8c4bdb4471-uuid-9097cf93-4d39-88d5-e0d1-05fdbe77e9f5.png" />
5. Click **Generate new token**.
6. **Optional:** In the **Note** field, add a description.
7. In the **Expiration** field, configure when the personal access token will expire \[recommended].
8. In the **Select scopes** field, select the **repo** checkbox to assign this set of permissions to the personal access token.

   <Image alt="GHE_create-PAT.png" border={false} src="https://files.readme.io/34c15b85ccb861f2705ec2558fe273620e52ffd3bfda8cebf45eebea74031738-uuid-bb164989-c356-5fe5-03e9-64efa893dbe5.png" />
9. **Optional:** Select additional permissions, if required by your environment.
10. Click **Generate Token**.

#### Proxy GitHub Enterprise with Go

<Callout icon="❗️" theme="error">
  **Go Proxy Best Practice: Add Mirror Repository**

  JFrog highly recommends that you create a remote repository pointing to the default Go mirror (**proxy.golang.org**) and enter **Artifactory** as the **Git provider**. This way, Artifactory will be able to resolve cached public modules without querying the external registry, reducing the chance of rate limiting. For more information, see [Set Up Go Proxy Mirror Repositories](#set-up-go-proxy-mirror-repositories).
</Callout>

To create a remote repository that serves as a caching proxy for GitHub Enterprise, follow these steps:

1. Create a new remote repository and set **Go** as the **Package Type**.
2. Set the **Repository Key** value, and enter your local GitHub Enterprise URL in the **URL** field.
3. Enter the username and personal access token that provides authentication to GitHub Enterprise. For more information about creating a personal access token, see [Generate a Personal Access Token in GitHub Enterprise](#generate-a-personal-access-token-in-github-enterprise).

   <Image alt="Go-proxy_GitHubEnterprise_blur.png" border={false} src="https://files.readme.io/2be53e6e09f87c28e7575f78d259f9a95ad9f1e2a8bb10b41d2fdc3d7fe40f85-uuid-652b62cc-9f51-a0d4-e6ea-89e308d41551.png" />
4. Scroll down to Go Settings and select a Git Provider:

   * For On-Prem, select **GitHub Server**.
   * For Cloud, select **GitHub Cloud**.
5. Click **Save & Finish**.

#### Proxy GitLab with Go

<Callout icon="❗️" theme="error">
  **Go Proxy Best Practice: Add Mirror Repository**

  JFrog highly recommends that you create a remote repository pointing to the default Go mirror (**proxy.golang.org**) and enter **Artifactory** as the **Git provider**. This way, Artifactory will be able to resolve cached public modules without querying the external registry, reducing the chance of rate limiting. For more information, see [Set Up Go Proxy Mirror Repositories](#set-up-go-proxy-mirror-repositories).
</Callout>

To create a remote repository that serves as a caching proxy for GitLab, follow these steps:

1. In Artifactory, click the **Administration** tab and select Repositories in the **Navigation** bar.
2. Click the **Create Repository** button and select **Remote** from the dropdown menu. The Select Package Type screen appears.
3. Select **Go** for the package type. The New Remote Repository screen for the Go package type appears, as shown below.

   <Image alt="Create_Go_remote_repo.png" border={false} src="https://files.readme.io/dc8a0a45a12b4af603474fd2933bdb417cdc45691b676f52aaab59aa8287b958-uuid-3b2a4a0d-b339-aee1-4944-4f0f034f3db1.png" />
4. Set the **Repository Key** value, and enter the link to your GitLab environment in the **URL** field:

   * For GitLab Self-managed, enter your environment link
   * For GitLab SaaS, enter `https://gitlab.com/`
5. Under **Go Settings**, set the **Git Provider** as **GitLab**. The Resolve Subgroups check box appears, as shown below.

   <Image alt="Resolve_subgroups_checkbox.png" border={false} src="https://files.readme.io/8004b69c7338d28f789029fd82f0e30b918941c7a8caa13c68d87088f652b2c9-uuid-69a72414-535a-c4bb-4e25-d31863d030aa.png" />
6. **Optional:** Select the **Resolve Subgroups** checkbox if you want Artifactory to automatically resolve sub-groups and sub-modules from gitlab.com. For more information, see [Resolving GitLab Subgroups](#resolving-gitlab-subgroups).
7. Enter your GitLab username and password. To generate a GitLab password:

   1. Go to your GitLab account, click your avatar in the top right corner, and select **Settings**.
   2. Go to **Access Tokens**, and click **Add new token**.

      <Image alt="Gitlab_personal_acces_stoken.png" border={false} src="https://files.readme.io/b53128cd22f76044afade65569924d5a0e86af402167f97e90db00e825f2a70c-uuid-faba0846-9395-e7f2-c21d-f98e946e64b8.png" />
   3. Enter a name and select permissions for your token: select the **api** and **read\_api** permissions, and add other permissions according to your environment. When you are done, click **Create personal access token**.

      <Image alt="gitlab_token_creation.png" border={false} src="https://files.readme.io/0f552d05c0fa1585647d61f6955da6b787987c729f92cdacf2562b051400a109-uuid-aef5d9cd-0eff-0e83-5f2a-9a326ed209aa.png" />
   4. Copy the token you created, and paste it into the **Password** field in Artifactory.
8. Click **Save & Finish**.
9. Create a new virtual repository and under **Repositories**, select the remote repository you have created.
10. Under **Include/ Exclude Patterns**, add the include pattern for GitLab, and click the **+** sign to add the pattern.

    * For GitLab Self-managed, enter your environment URL in this structure: `**/<YOUR_URL>/**`
    * For GitLab SaaS, enter `**/gitlab.com/**`.

    You can use the virtual repository to resolve artifacts from your GitLab private registry.

#### Proxy Bitbucket Cloud with Go

<Callout icon="❗️" theme="error">
  **Go Proxy Best Practice: Add Mirror Repository**

  JFrog highly recommends that you create a remote repository pointing to the default Go mirror (**proxy.golang.org**) and enter **Artifactory** as the **Git provider**. This way, Artifactory will be able to resolve cached public modules without querying the external registry, reducing the chance of rate limiting. For more information, see [Set Up Go Proxy Mirror Repositories](#set-up-go-proxy-mirror-repositories).
</Callout>

To create a remote repository that serves as a caching proxy for Bitbucket Cloud, follow these steps:

1. Create a new remote repository and set **Go** as the **Package Type**.
2. Set the **Repository Key** value, and enter `https://bitbucket.org/` in the **URL** field.
3. Scroll down to Go Settings and select **Bitbucket Cloud** for the Git Provider.
4. In the **Advanced** tab, enter your Bitbucket username and password. To generate a Bitbucket password:

   1. Go to your Bitbucket account, click the gear icon in the top right corner, and select **Personal Bitbucket settings**.

      <Image align="center" alt="Bitbucket_cloud_1.png" border={true} src="https://files.readme.io/a0445244fc3b90fdad6c1e8568cd986f478b1f20ed488e8fbe0835917777989f-uuid-439ab618-597e-5664-bf02-20f382523937.png" className="border" />
   2. Go to **App passwords**, and click **Create app password**.

      <Image align="center" alt="bitbucket_cloud_2.png" border={true} src="https://files.readme.io/f8bd680735a53ff2778a825dfead58c5af4abd39505ba084eab52b2bd85976c6-uuid-b24d8706-70ad-546c-be70-e3344512b3b2.png" className="border" />
   3. Select permissions for your password: select **Read** permission for Repositories, and if you need to, add other permissions according to your environment. When you are done, click **Create**.

      <Image alt="bitbucket_cloud_3.png" border={false} src="https://files.readme.io/878acb72402d962ae7d0c9e97e58858759f9965d849ffba22844a0c374c9e9f0-uuid-8c18a3c8-55d1-753c-8cf0-a5ef04d2cbcf.png" />
   4. Copy the password you created, and paste it into the **Password** field in the JFrog platform.
5. Click **Save & Finish**.
6. Create a [new virtual repository](#create-a-go-repository-in-artifactory) and under **Repositories**, select the remote repository you have created. You can use the virtual repository to resolve artifacts from your Bitbucket Cloud private registry.

#### Proxy Bitbucket Server with Go

<Callout icon="❗️" theme="error">
  **Go Proxy Best Practice: Add Mirror Repository**

  JFrog highly recommends that you create a remote repository pointing to the default Go mirror (**proxy.golang.org**) and enter **Artifactory** as the **Git provider**. This way, Artifactory will be able to resolve cached public modules without querying the external registry, reducing the chance of rate limiting. For more information, see <Anchor label="Set Up Go Proxy Mirror Repositories" title="Set Up Go Proxy Mirror Repositories" href="#set-up-go-proxy-mirror-repositories">Set Up Go Proxy Mirror Repositories</Anchor>.
</Callout>

To create a remote repository that serves as a caching proxy for Bitbucket Server, follow these steps:

1. Create a new remote repository and set **Go** as the **Package Type**.
2. Set the **Repository Key** value, and enter your Bitbucket URL in the **URL** field: for example, `https://git.acme.org/`.
3. Scroll down to Go Settings and select **Bitbucket Server** for the Git Provider.
4. In the **Advanced** tab, enter the username Bitbucket account under **Username**, and your token under **Password**. To create a token:

   1. Go to your Bitbucket account, click your avatar in the top right corner, and select **Manage account**.

      <Image align="center" alt="Bitbucket_server_1.png" border={true} src="https://files.readme.io/ce529273396c699e76543eea2c064e5eda6ae3a3636c7f0bd57117ab699bad6a-uuid-36359b42-f346-58d3-4ef5-8557ac429b1d.png" className="border" />
   2. Go to **HTTP Access tokens**, and click **Create token**.

      <Image align="center" alt="bitbucket_server_2.png" border={true} src="https://files.readme.io/67d067dad8c1692a602859be77253bd82c4ab9dd597949b12d66fdf1e03dda0d-uuid-162ddb5f-5740-9953-9df3-557c0fef0d45.png" className="border" />
   3. Give a label and select permissions for your password: select **Read** permission for Repositories, and if you need to, add other permissions according to your environment. When you are done, click **Create**.

      <Image align="center" alt="bitbucket_server_3.png" border={true} src="https://files.readme.io/94fde3df966516e376c73abd9b1bdb302d0f0122bf41e7bb8822f93ad4b2190b-uuid-408d4fd2-004b-99a3-7dfc-ef6918a2f5fc.png" className="border" />
   4. Copy the token you created, and paste it into the **Password** field in the JFrog platform.
5. Click **Save & Finish**.
6. Create a [new virtual repository](#create-a-go-repository-in-artifactory) and under **Repositories**, select the remote repository you have created. You can use the virtual repository to resolve artifacts from your Bitbucket Server private registry.

### Work with GOSUMDB

<Anchor label="Go Client 1.13" target="_blank" href="https://golang.org/doc/go1.13">Go Client 1.13</Anchor> introduced support for checksum verifications of modules against a central server (sum.golang.org). Artifactory can proxy and cache requests to sum.golang.org for clients that use Artifactory as a Go proxy. This feature works without any additional configurations for remote sites pointing to GitHub or another Artifactory server.

You can override the default central server used by Artifactory to provide the checksums by adding the property `artifactory.go.sumdb.url.override=` `https://..`. to your  [Artifactory's system properties](/installation/docs/artifactory-configuration-files).

You can disable this feature by adding the property `artifactory.go.sumdb.enabled=false`.

Private GitHub repositories and some remote sites do not provide checksums. The Go client in those cases will complain about missing the checksum. You can control this feature on the client side with the `GOPRIVATE` and `GONOSUMDB` environment variables. See the <Anchor label="Go 1.13 Modules environment variables" target="_blank" href="https://golang.org/doc/go1.13#modules">Go 1.13 Modules environment variables</Anchor> for full details.

## Advanced Configuration for Virtual Go Repositories

Some <Anchor label="Remote Import Paths" target="_blank" href="https://golang.org/cmd/go/#hdr-Remote_import_paths">Remote Import Paths</Anchor> may use `go-import` meta tags on the remote repository response body to declare the location of a remote VCS root to follow. By default, this behavior is enabled in virtual Go repositories, and Artifactory will follow these tags to download remote modules. To disable this behavior, select the **Advanced** tab and then uncheck the **Enable 'go-import' Meta Tags** checkbox, as shown below.

<Image alt="Go_virtual_repo.png" border={false} src="https://files.readme.io/4ed6b880aa20182e12ac34783659566a2aea6e890415fc4a8b4b33a4edb703f4-uuid-e30ee3e8-7f21-d84f-c56d-c4a47d923d73.png" />

<Table>
  <thead>
    <tr>
      <th>
        Field
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        Enable 'go-import' Meta Tags
      </td>

      <td>
        When checked (default), Artifactory will automatically follow remote VCS roots in `go-import` meta tags to download remote modules.
      </td>
    </tr>

    <tr>
      <td>
        'go-import' Allow List
      </td>

      <td>
        An Allow List of Ant-style path patterns that determine which remote VCS roots Artifactory will follow to download remote modules from when presented with `go-import` meta tags in the remote repository response. By default, this is set to `**` which means that remote modules may be downloaded from any external VCS source.

        For example, if you wish to limit remote `go-import` modules to only be downloaded from <Anchor label="github.com" target="_blank" href="http://github.com/">github.com</Anchor>, you should remove the default `**` pattern and replace it with `**/ github.com/**`.
      </td>
    </tr>
  </tbody>
</Table>

## Resolving GitLab Subgroups

GitLab has a feature called <Anchor label="subgroups" target="_blank" href="https://docs.gitlab.com/user/group/subgroups/">subgroups</Anchor>. When selecting GitLab as the Git provider for a Go remote repository, a checkbox appears called Resolve Subgroups (for configuration instructions, see [Proxy GitLab with Go](#proxy-gitlab-with-go)). When selected, Artifactory will determine sub-groups and sub-modules from URL paths and resolve any dependencies. If not selected, Artifactory will resolve Go modules by treating the /name/ as a submodule. By default, this checkbox is not selected.

The option to resolve subgroups was added to the Go remote repository configuration because GitLab implemented a change in the API path that is not part of the **.git** protocol. Artifactory can identify if the path is in fact a sub-group or a sub-module and resolve the correct dependency version.

### Best Practices

Go remote repositories only work via a virtual repository. Therefore, a dedicated remote repository should be defined to the specific subgroup URL. You can decide on the remote resolution order, either go to a regular repository first and then a subgroup, or the other way around by ordering the list of remote repositories in the virtual repository.

# Limitations of Go in Artifactory

* Go remote repositories can only be accessed directly through a virtual repository. To resolve an artifact from a remote repository, you must [create a virtual repository](#create-a-go-repository-in-artifactory), connect it to the remote repository, and use it to resolve the artifact.