I'm trying to push a Node.js application to Heroku. The app uses npm to fetch private github repositories, which are specified in
package.json
"dependencies": {
"my-private-dep": "github:my-org/my-repo"
}
npm install
known_hosts
remote: npm ERR! Host key verification failed.
It turns out that there is a buildpack that makes this relatively easy -
https://github.com/debitoor/ssh-private-key-buildpack
However, I found that, for whatever reason, setting the SSH_HOSTS
environment variable was not working correctly for me - according to the docs, it is supposed to set Github by default, and then you can add others if you like... I am actually using Gitlab for this particular project, but found that when I set the config like so:
$ heroku config:set SSH_HOSTS="[email protected]"
it was not being detected. I ended up cloning the buildpack and changing bin/compile
line 13 to
ssh_hosts=${SSH_HOSTS:-"[email protected]"}
and just pushing it up to my own repo to use for this project. Worked like a charm.