Multiple github private npm repositories on a server

I have a node application on github in a private repository. This node application also has custom modules that I made and they are in a separate private repository.

This is the example node application url:

git@github.com:thomas/node-application.git

These are both node modules that node application uses.

git@github.com:thomas/node-module1.git
git@github.com:thomas/node-module2.git

You can use the following to install a private npm module on github.

npm install git+ssh://git@github.com:thomas/node_module1.git

In order for this to work the machine needs to have ssh keys setup.

My local machine has my github user keys set up and access to all my repos.

On my server, however I'm using deploy keys. The only way I know how to use multiple deploy keys is as follows.

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

So I'd need to install the modules on the server with

npm install git+ssh://git@nm1.github.com:thomas/node_module1.git
                          ^^^

Which means that the production and development dependancies would be different

"node-module": "git+ssh://git@github.com:thomas/node-module1.git"

vs

"node-module": "git+ssh://git@nm1.github.com:thomas/node-module1.git"
                              ^^^

This could work if I could do something like this…

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

Take a look at the Node.js Documentation on loading modules from the global directory or a different path.

http://nodejs.org/api/modules.html#modules_loading_from_the_global_folders