【发布时间】:2014-01-06 18:39:21
【问题描述】:
我正在尝试从pygit2/libgit2 中推送引用:
push_refspec = git_repo.lookup_reference('HEAD').resolve().name
logger.info("Pushing " + push_refspec)
git_remote.push(push_refspec)
但是,我收到有关缺少凭据的错误:
_pygit2.GitError: Cannot set up SSH connection without credentials
这最终来自libssh2,来自libgit2 (transports/ssh.c) 的调用:
if (user && pass) {
if (git_cred_userpass_plaintext_new(&t->cred, user, pass) < 0)
goto on_error;
} else if (t->owner->cred_acquire_cb) {
if (t->owner->cred_acquire_cb(
&t->cred, t->owner->url, user,
GIT_CREDTYPE_USERPASS_PLAINTEXT |
GIT_CREDTYPE_SSH_KEY |
GIT_CREDTYPE_SSH_CUSTOM,
t->owner->cred_acquire_payload) < 0)
goto on_error;
if (!t->cred) {
giterr_set(GITERR_SSH, "Callback failed to initialize SSH credentials");
goto on_error;
}
} else {
giterr_set(GITERR_SSH, "Cannot set up SSH connection without credentials");
goto on_error;
}
使用 Git 客户端来自存储库的 push 工作正常。我试过GIT_SSL_NO_VERIFY=true(不出所料)没有用。
我需要设置哪些额外信息才能使其正常工作?
【问题讨论】:
标签: git libgit2 libssh2 pygit2