Create a GitLab(GL) access token

The first thing we need to do is create an access token in GL. In GL, under your profile, click on Access Tokens in the sidebar. This will bring up a screen for us to create a new token under our profile.

  • Name the token whatever you’d like. Example: my-gds-token.
  • You can leave the expiration blank.
  • You can select all scopes.
  • Press the Create personal access token button.

This will refresh the screen and present you with a shiny, brand-new access token. Copy it, we will be putting it to work.

Edit your .npmrc

We now need to tell npm that we want to use a private repository when installing our package.

Here are two two ways we can do that:

  • Open your terminal of choice and edit your local .npmrc file.
  • Add a .npmrc file to your current npm project at the root level.

However you decide to add these credentials paste the following into the file.


Note: Replace ACCESS_TOKEN with the access token you created in GitLab.

Checkout this quick video!