Hi awesome heroku python people.
would be great if we could:
using our uploaded key to access github via ssh
(sorry if this already possible -- but not working for us. Right now we need to rely on basic auth -- and doesn't feel right to us -- we do not like having the username/password in source)
(for others: this is KR post on SO: http://stackoverflow.com/a/9136665/192791)
I would currently recommend the way mentioned
Using the key you have registered with heroku would be cool, but unfortunately, you would have to provide your private key for this to work. Quite undesirable.
However, you could also write your keys into a .ssh folder in your app or use .profile scripts to facilitate this.
Thanks for remind me about this .profile scripts!
So, if my app have an .ssh folder, it is honored?
I have no problem with a private key because its created and used only for this project and its private repos, as a deploy-key. I did not know that the compile scripts honors .ssh folder, so I ended up using the bin/pre_compile hook of the Python's buildpack to overwrite if something there already:
# file: bin/pre_compile
set -eo pipefail
# The post_compile hook is run by heroku-buildpack-python
echo "-----> I'm pre-compile hook"
echo "setting up ~/.ssh/ via /deploy/ files"
mkdir -p $HOME/.ssh
cat >$HOME/.ssh/config <<EOF
[ -f $HOME/deploy/id_rsa ] && cp $HOME/deploy/id_rsa $HOME/.ssh/id_rsa
[ -f $HOME/deploy/id_rsa.pub ] && cp $HOME/deploy/id_rsa.pub $HOME/.ssh/id_rsa.pub
echo "-----> Pre-compile done"
Just renamed the /deploy/ to .ssh/ and it worked. No pre_compile needed. Nice!
Thanks K, lets close this out