Create a Gitlab Remote repository

ARTIFACTORY: Configure an NPM Gitlab registry in remote repository

AuthorFullName__c
Shisiya Sebastian
articleNumber
000005561
ft:sourceType
Salesforce
FirstPublishedDate
2023-01-29T09:23:43Z
lastModifiedDate
2023-01-29
VersionNumber
1
The steps to mirror the Gitlab private repository in JFrog Artifactory.
Step 1: Create a Deploy token from Gitlab and copy the Username and Access token
Step 2: Create an NPM remote repository in Artifactory with the Gitlab URL

1. Go to Artifactory → Administration → Repositories → Add Repositories → Remote Repositories → NPM
2. Create a repository with <your_npm_reponame> as the Repository Key
3. Update URL field with the Gitlab registry URL in the below format
https://gitlab.com/api/v4/projects/<project_ID>/packages/npm/
4. Add the Deploy Token username and Access token
5. Create Remote Repository

Here is an example of a remote npm repository with the name “npmlab”

User-added image


Note: Since it is a private registry, “Test” may show “Target remote URL returned error 404: Not Found”, however you can ignore this error message and move forward.

Step 3: Copy the NPM client configuration snippets from “Set Me Up” and update .npmrc

1. Go to Artifactory → Application → Artifacts → your_npm_reponame → Set Me Up(Top Right Hand Side)
2. Enter password in the respective text box and copy the code snippet for scoped packages under Using basic authentication
3. Replace <SCOPE> with the scope in your registry

User-added image

4. Add the code snippet to ~/.npmrc file(If Windows, %USERPROFILE%\.npmrc)
 
User-added image


Step 4: Install npm package using “npm install @<SCOPE>/package_name”