Open
Description
I can clone from a private repo by specifying the path to he ssh
key, like this:
git_dir = "git@github.com:user_id/repo_name.git"
save_at = './'
Repo.clone_from(git_dir, save_at, env={"GIT_SSH_COMMAND": 'ssh -o StrictHostKeyChecking=no -i ./my_path/mykey'})
However, I this code cannot pull from the same private repo
repo = Repo(save_at)
ssh_cmd = 'ssh -o StrictHostKeyChecking=no -i ./my_path/mykey'}
with repo.git.custom_environment(GIT_SSH_COMMAND=ssh_cmd):
repo.remotes.origin.pull('master')
and throws the error
File "/usr/local/lib/python3.10/site-packages/git/remote.py", line 910, in pull
res = self._get_fetch_info_from_stderr(proc, progress,
File "/usr/local/lib/python3.10/site-packages/git/remote.py", line 750, in _get_fetch_info_from_stderr
proc.wait(stderr=stderr_text)
File "/usr/local/lib/python3.10/site-packages/git/cmd.py", line 502, in wait
raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
cmdline: git pull -v origin master
stderr: 'fatal: Could not read from remote repository.'
What am I missing here?