npm通过依赖关系在package.json中安装私有github仓库

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

如下:

"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"
}