npm 通过 package.json 中的依赖安装私有 github 存储库 [英] npm install private github repositories by dependency in package.json

查看:83
本文介绍了npm 通过 package.json 中的依赖安装私有 github 存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 npm 安装 github 私有存储库,其中包含其他私有 github 存储库作为依赖项.

I'm trying to install github private repository by npm that includes other private github repositories as dependency.

尝试了很多方法和帖子,但都没有奏效.这是我在做什么:

Have tried a lot of ways and posts but none is working. Here is what i'm doing :

npm install git+https://github.com/myusername/mygitrepository.git

在 package.json 中是这样的:

in package.json is like :

"dependencies": {
    "repository1name": "git+https://github.com/myusername/repository1.git",
    "repository2name": "git+https://github.com/myusername/repository2.git"
}

正确的做法是什么?

推荐答案

以下在我需要的所有场景中都运行良好:

The following worked just fine in all scenarios i needed :

"dependencies": {
"GitRepo": "git+https://<token-from-github>:x-oauth-basic@github.com/<user>/<GitRepo>.git"
}

这篇关于npm 通过 package.json 中的依赖安装私有 github 存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆