2013-02-18 92 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

回答

相關問題