support ssh in requirements.txt #97

jtushman opened this Issue Jul 9, 2013 · 5 comments


None yet

3 participants

jtushman commented Jul 9, 2013

Hi awesome heroku python people.

would be great if we could:

# requirements.txt

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:

alanjds commented Jul 12, 2013



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.

alanjds commented Jul 12, 2013

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:

#!/usr/bin/env bash
# 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
StrictHostKeyChecking no

[ -f $HOME/deploy/id_rsa ] && cp $HOME/deploy/id_rsa $HOME/.ssh/id_rsa
[ -f $HOME/deploy/ ] && cp $HOME/deploy/ $HOME/.ssh/

echo "-----> Pre-compile done"
alanjds commented Jul 12, 2013

Just renamed the /deploy/ to .ssh/ and it worked. No pre_compile needed. Nice!


Thanks K, lets close this out

@jtushman jtushman closed this Jul 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment