Skip to content

Instantly share code, notes, and snippets.

@mgwilliams
Created December 21, 2013 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgwilliams/b48fe2baa5d405edb30b to your computer and use it in GitHub Desktop.
Save mgwilliams/b48fe2baa5d405edb30b to your computer and use it in GitHub Desktop.
ssh = tempfile.NamedTemporaryFile(delete=False)
ssh.write('#! /bin/sh\nssh -oUserKnownHostsFile={0}/{1} $@'.format(os.environ.get('HOME', '~/'), '.ssh/known_hosts'))
st = os.stat(ssh.name)
os.chmod(ssh.name, st.st_mode | stat.S_IEXEC)
os.putenv('GIT_SSH', ssh.name)
ssh.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment