henry.oswald henry.oswald - 3 months ago 22
Node.js Question

NPM private git module on Heroku

I am trying to deploy my app to Heroku however I rely on using some private git repos as modules. I do this for code reuse between projects, e.g. I have a custom logger I use in multiple apps.

"logger":"git+ssh://git@bitbucket.org..............#master"


The problem is Heroku obviously does not have ssh access to this code. I can't find anything on this problem. Ideally Heroku have a public key I can can just add to the modules.

Answer

In short it is not possible. The best solution to this problem I came up with is to use the new git subtree's. At the time of writing they are not in the official git source and so needs to be installed manual but they will be included in v1.7.11. At the moment it is available on homebrew and apt-get. it is then a case of doing

git subtree add -P /node_modules/someprivatemodue git@github.......someprivatemodule {master|tag|commit}

this bulks out the repo size but an update is easy by doing the command above with gitsubtree pull.