I am creating a node.js application that serves as a web hook for Github that will automatically deploy a specific private repo when the changes are applied. To make the webhook application as efficient as possible, I want to clone and pull the private repo to a temporary directory in my Heroku web hosting instance when it is deployed, so when the webhook fires, I only need to “git pull” to get latest updates and their deployment. It's easy enough to run the shell script when the webhook application is deployed (using package.json or Procfile), but before I run the git commands, I need to set the deployment private key. The private and public key are currently in my webhook registry (I know, I know, as soon as I earn it,I will do better), so I tried installing it by adding it to my shell script (which was suggestedhere )
mkdir /app/.ssh
cp config/ssh/* /app/.ssh/
mkdir /tmp/repos
git clone --bare ssh://github.com/<username>/<repo>.git /tmp/repos/<repo>
but I get:
Initialized empty git repository at / tmp / repos / assets / Error checking host key. fatal: the far end unexpectedly hung up
The public key was added as a deployment key in the repo that I am pulling, so my questions are:
- Am I installing the private key in the correct directory?
- Should a private key file have a specific name?
- Is this approach even possible / recommended?
- If not the best alternative?
Thank!
source
share