Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use private GitLab repository as npm dependency with private token through https

I'm trying to use a private GitLab repo as npm dependency in my node js app, with a private token key, something like this:

"dependencies": {
     "my-module": "git+https://<privateToken>:x-oauth-basic@<myGitLabURL>/<MyUser>/my-module.git"
}

when I run npm install I get errors about the git clone with fatal: unable to access <git repo path> with 443 Connection refused replies.

I couldn't find a lot of documentation of how to do this through https and not through ssh. It seems like it does work on GitHub

Anybody have experience with this on GitLab with Https?

like image 928
Zohar Levin Avatar asked Dec 23 '15 15:12

Zohar Levin


1 Answers

This answer worked for me.

"my-module": "https://oauth2:<PersonalAccessToken>@gitlab.com/<group>/<repository-name>.git

You can create a Personal Access Token under User Settings->Access Tokens (GitLab.com Link).

like image 131
Splaktar Avatar answered Oct 25 '22 17:10

Splaktar