GitPythonを使用してGithubアカウントからレポを取得しようとしています。これは後でGitPython + SSHキーを使用したGitプルが機能しない
(1)私はすでにコマンドラインからgitクローンを実行しました。
ssh-keygen -t rsa -b 4096
(3)セットアップ新しいSSHキーとしてのGithub上記#2から.PUBファイルの内容を使用して
(2)生成された新しいSSHキー。
Githubのユーザー名とパスワードを入力するよう求められます。何故ですか ?
ここは私の.gitフォルダ内の設定です。 HTTP注:// URLではなく、https://でここ
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = http://github.com/githubuser/myrepo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
は私のコードスニペットで
import git, os
DIR_NAME = 'path/to/dir/with/gitfolder'
git_ssh_identity_file = os.path.expanduser('/path/to/rsa/key')
git_ssh_cmd = 'ssh -i %s' % git_ssh_identity_file
with git.Git().custom_environment(GIT_SSH_COMMAND=git_ssh_cmd):
repo = git.Repo.init(DIR_NAME)
origin = repo.remote()
refs = origin.refs
for ref in refs:
if ref.remote_head == "master":
origin.pull(ref.remote_head)
秘密鍵をchmodしましたか? – Vetsin