2014-01-06 4 views
1

내가 내 pygit2/libgit2에서 참조를 밀어 시도하고있다 :libgit2/libssh2 용 ssh 자격 증명을 설정하는 방법은 무엇입니까?

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 

을이 궁극적으로 libgit2에서 전화를 통해 libssh2에서 온다 (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 클라이언트를 사용하는 저장소의은 정상적으로 작동합니다. 나는 (놀랄 것도없이) 작동하지 않았다 GIT_SSL_NO_VERIFY=true을 시도했다.

이 기능을 사용하려면 어떤 추가 정보를 설정해야합니까?

답변

4

pygit2는 아직 libgit2의 인증 된 네트워크 작업을 지원하지 않습니다. some API discussion happening이 있지만 아무 것도 마무리되지 않았습니다.

편집 :이 답변은 수락되었으므로 구현되었습니다. documentation에는 이에 대한 메모가 있습니다.

+0

아휴, 나는 그 때 기다려야 할 것이다. 포인터 주셔서 감사! –

+1

완료된 것 같습니다. –

관련 문제