Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitPython and SSH Keys?

Tags:

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).

like image 530
andreihondrari Avatar asked Feb 03 '15 05:02

andreihondrari


People also ask

Can I use Git with Python?

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.

How do I add a SSH key to r studio?

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).


1 Answers

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') 
like image 103
Vijay Katam Avatar answered Sep 21 '22 20:09

Vijay Katam