【问题标题】:how to use private GitLab repository as npm dependency with private token through https如何通过 https 使用私有 GitLab 存储库作为带有私有令牌的 npm 依赖项
【发布时间】:2016-03-30 02:21:11
【问题描述】:

我正在尝试在我的节点 js 应用程序中使用私有 GitLab 存储库作为 npm 依赖项,并使用私有令牌密钥,如下所示:

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

当我运行 npm install 时,我收到有关带有 fatal: unable to access &lt;git repo path&gt; 的 git clone 的错误,其中 443 连接被拒绝回复。

我找不到很多关于如何通过 https 而不是通过 ssh 执行此操作的文档。 好像是it does work on GitHub

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

【问题讨论】:

标签: node.js https npm gitlab


【解决方案1】:

这个answer 为我工作。

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

您可以在用户设置->访问令牌(GitLab.com Link)下创建个人访问令牌。

【讨论】:

    猜你喜欢
    • 2015-04-28
    • 2019-06-21
    • 2019-02-20
    • 2019-02-25
    • 2014-06-06
    • 2023-03-09
    • 1970-01-01
    • 2023-04-06
    • 2012-04-03
    相关资源
    最近更新 更多