I have a GitLab domain, project and repo. This project is accessible via a group I am apart of.
I would like for this to be downloaded via npm install
in the following ways:
I'm guessing the easiest way of doing this is to just make it public. Is there a way to fix this so it is secure. I can imagine that it must be done with keys.
In my package.json
under dependencies I currently have this, but it gives a 401 error of course:
"my-module": "my-domain.com:my-project/my-repo#my-branch",
I do not want hardcoded tokens in the package.json
file, if it can be avoided.
You can use SSH keys to access your repository. Add ssh keys to GitLab server and define url to your repsitory in following form:
git+ssh://git@git.mydomain.com:Username/Repository#{branch|tag}
or
git+ssh://git@git.mydomain.com/Username/Repository#{branch|tag}
In your package.json
it will be something like this "my-module": "git+ssh://git@my-domain.com:my-project/my-repo#my-branch"
If your ssh key is password protected, then npm will ask for password.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.