【发布时间】: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 <git repo path> 的 git clone 的错误,其中 443 连接被拒绝回复。
我找不到很多关于如何通过 https 而不是通过 ssh 执行此操作的文档。 好像是it does work on GitHub
有人在 GitLab 上使用 Https 有这方面的经验吗?
【问题讨论】:
-
我使用了这篇文章,它对我有用。 stackoverflow.com/questions/28728665/…
-
您需要在项目的“部署密钥”中注册您的公钥。很久以前,有一个带有令牌的 url,它可以让你只读 https 访问(所以 npm install 也是如此),但它不再有效。类似于“git+gitlab-ci-token:55c302991447875db1242a9e8bcd59@gitlab.com/user/… --branch 2.0.0”。据我所知,现在唯一实际(且安全)的方式是“部署密钥”方式。