Go Proxy Best Practice: Add Mirror Repository
We highly recommend that you create a remote repository pointing to the default go mirror (gocenter.io) 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.
To create a remote repository that serves as a caching proxy for GitLab, follow these steps:
Create a new remote repository and set Go as the Package Type.
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/
In the Go Settings tab, set the Git Provider as GitLab.
In the Advanced tab, enter your GitLab username and password. To generate a GitLab password:
Go to your GitLab account, click your avatar in the top right corner, and select Settings.
Go to Access Tokens, and click Add new token.
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.
Copy the token you created, and paste it into the Password field in the JFrog platform.
Click Save & Finish.
Create a new virtual repository and under Repositories, select the remote repository you have created.
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.