Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pulling from private repo #1489

Open
Open
@rogelioamancisidor

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /