2013-02-18 107 views
5

我在私有存储库的github上有一个节点应用程序。此节点应用程序还具有我制作的自定义模块,它们位于单独的私有存储库中。服务器上的多个github私有npm存储库

这是例如节点应用URL:

[email protected]:thomas/node-application.git 

这些是节点应用同时使用节点的模块。

[email protected]:thomas/node-module1.git 
[email protected]:thomas/node-module2.git 

您可以使用以下方法在github上安装私有npm模块。

npm install git+ssh://[email protected]:thomas/node_module1.git 

为了这个工作机器需要有ssh密钥设置。

我的本地机器有我的github用户密钥设置和访问我所有的回购。

在我的服务器上,但是我使用的是部署密钥。我知道如何使用多个部署密钥的唯一方法如下。

Host na.github.com 
HostName github.com 
User git 
IdentityFile ~/.ssh/gh_node-application 
ForwardAgent yes 

Host nm1.github.com 
HostName github.com 
User git 
IdentityFile ~/.ssh/gh_node-module1 
ForwardAgent yes 

Host nm2.github.com 
HostName github.com 
User git 
IdentityFile ~/.ssh/gh_node-module2 
ForwardAgent yes 

所以我需要与

npm install git+ssh://[email protected]:thomas/node_module1.git 
          ^^^ 

在服务器上安装模块这意味着生产和研发的依赖关系会有所不同

"node-module": "git+ssh://[email protected]:thomas/node-module1.git" 

VS

"node-module": "git+ssh://[email protected]:thomas/node-module1.git" 
           ^^^ 

,如果我可以做这样的事情这可能工作...

Host github.com 
HostName github.com 
User git 
IdentityFile ~/.ssh/gh_node-application 
IdentityFile ~/.ssh/gh_node-module1 
IdentityFile ~/.ssh/gh_node-module2 
ForwardAgent yes 
+0

我去[机用户]的途径(https://help.github.com/articles/managing-deploy-keys)。我真的很讨厌XD – ThomasReggi 2013-02-18 22:11:49

+0

你有没有尝试将你的部署密钥添加到你的github帐户?所有添加到您帐户的密钥将允许您访问您的私人包裹。只有在没有太多密钥的情况下,此解决方案才有效,并且不会频繁更改。 – vmx 2013-12-12 12:33:05

回答

相关问题