GitPython and SSH Keys?

前端 未结 5 878
生来不讨喜
生来不讨喜 2020-12-14 02:23

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)

5条回答
  •  悲&欢浪女
    2020-12-14 03:06

    In case of a clone_from in GitPython, the answer by Vijay doesn't work. It sets the git ssh command in a new Git() instance but then instantiates a separate Repo call. What does work is using the env argument of clone_from, as I learned from here:

    Repo.clone_from(url, repo_dir, env={"GIT_SSH_COMMAND": 'ssh -i /PATH/TO/KEY'})
    

提交回复
热议问题