如何通过https使用私有GitLab存储库作为与私有令牌的npm依赖关系

我试图在我的节点js应用程序中使用私有GitLab回购作为npm依赖关系,使用私有令牌密钥,如下所示:

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

当我运行npm install我得到有关git克隆fatal: unable to access <git repo path>错误fatal: unable to access <git repo path>与443连接被拒绝的答复。

我找不到很多关于如何通过https而不是通过ssh来完成的文档。 它似乎在GitHub上工作

有人在GitLab上使用Https有这方面的经验吗?

这个答案为我工作。

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

您可以在用户设置 – >访问令牌( GitLab.com链接 )下创build个人访问令牌。