Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cedricziel
Created February 13, 2014 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cedricziel/8973606 to your computer and use it in GitHub Desktop.
Save cedricziel/8973606 to your computer and use it in GitHub Desktop.
Openshift git wrapper script creation for being able to use private git repos
#!/usr/bin/env bash
# copy this script to your gear, make it executable and run it once
# make the appropriate directory
mkdir -p "$OPENSHIFT_DATA_DIR/.ssh"
# generate a key
ssh-keygen -q -t rsa -f $OPENSHIFT_DATA_DIR/.ssh/id_rsa -N ""
# create a wrapper script
printf "#!/bin/bash \nssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${OPENSHIFT_DATA_DIR}.ssh/id_rsa $1 $2" > $OPENSHIFT_DATA_DIR/git-ssh
# make the wrapper executable
chmod +x "$OPENSHIFT_DATA_DIR/git-ssh"
# add the wrapper to .bash_profile so it will be used everywhere
echo "export GIT_SSH=$OPENSHIFT_DATA_DIR/git-ssh" >> $OPENSHIFT_DATA_DIR/.bash_profile
@jrichardsz
Copy link

Thank you doc!
Very usefful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment