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

too difficult to use #1390

Answered by Byron
lybmccree asked this question in Q&A
Discussion options

I just want to git pull like git bash
i set rsa with empty password
when i code these

#"D:/work/test_git" it's my local git folder, it's clone from remote
repo_path = "D:/work/test_git"
repo = git.Repo(repo_path)
repo.git.pull()

it always show me

git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
 cmdline: git pull
 stderr: 'Host key verification failed.
fatal: Could not read from remote repository.

these is no useful information in the net
it's too difficult to use, is there any easy way to show developer to use???
maybe you can write a right example code to show how to use.
i use git bash to git pull , it's work fine. these is no problem in git bash with my git ssh

ENV: windows 10
python 2.7.17
gitpython 2.1.15

You must be logged in to vote

GitPython calls git in a way that hides the terminal which sometimes leads to authentication issues. Since the password is empty, I'd expect using the private key on the client machine not to be the problem.

Searching for Hist key verification failed yields this answer which points the finger at the remote host. Probably SSH wants to ask if using this host key is alright, as it apparently isn't known yet, but it can't as there is no Terminal.

You could try to use HTTPS remote URLs instead of the ones using SSH as this bypasses the need for a key entirely. Alternatively, you could use this portion of the docs to configure a custom ssh executable and pass the required ssh flags.

ssh_executable

Replies: 1 comment

Comment options

GitPython calls git in a way that hides the terminal which sometimes leads to authentication issues. Since the password is empty, I'd expect using the private key on the client machine not to be the problem.

Searching for Hist key verification failed yields this answer which points the finger at the remote host. Probably SSH wants to ask if using this host key is alright, as it apparently isn't known yet, but it can't as there is no Terminal.

You could try to use HTTPS remote URLs instead of the ones using SSH as this bypasses the need for a key entirely. Alternatively, you could use this portion of the docs to configure a custom ssh executable and pass the required ssh flags.

ssh_executable = os.path.join(rw_dir, 'my_ssh_executable.sh')
with repo.git.custom_environment(GIT_SSH=ssh_executable):
 repo.remotes.origin.fetch()

The example below sets a key, but can be used to pass any parameters.

#!/bin/sh
ID_RSA=/var/lib/openshift/5562b947ecdd5ce939000038/app-deployments/id_rsa
exec /usr/bin/ssh -o StrictHostKeyChecking=no -i $ID_RSA "$@"
You must be logged in to vote
0 replies
Answer selected by Byron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1389 on January 06, 2022 13:17.

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