Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

support ssh in requirements.txt #97

Closed
jtushman opened this Issue · 5 comments

3 participants

@jtushman

Hi awesome heroku python people.

would be great if we could:

# requirements.txt
requests==1.2.2
git+ssh://git@github.com/jtushman/dict_digger.git@v0.1.0

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)

Thanks!

(for others: this is KR post on SO: http://stackoverflow.com/a/9136665/192791)

@alanjds

+1

@kennethreitz

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

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
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"
@alanjds

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

@jtushman

Thanks K, lets close this out

@jtushman jtushman closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.