How can I use GitPython along with specific SSH Keys?
The documentation isn't very thorough on that subject. The only thing I've tried so far is Repo(path)
.
GitPython is a python library used to interact with git repositories. It is a module in python used to access our git repositories. It provides abstractions of git objects for easy access of repository data, and additionally allows you to access the git repository more directly using pure python implementation.
In RStudio, go to menu Tools / Global options / Git SVN / View public key and copy the key to your Github account setting (Edit profile / SSH keys / Add SSH key).
Following worked for me on gitpython==2.1.1
import os from git import Repo from git import Git git_ssh_identity_file = os.path.expanduser('~/.ssh/id_rsa') git_ssh_cmd = 'ssh -i %s' % git_ssh_identity_file with Git().custom_environment(GIT_SSH_COMMAND=git_ssh_cmd): Repo.clone_from('git@....', '/path', branch='my-branch')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With