From 9aa39aafbc4e9e5920086cdafdb96270ee66ebe5 Mon Sep 17 00:00:00 2001 From: Ash Berlin Date: Tue, 7 Oct 2014 09:47:59 +0100 Subject: [PATCH] Use ssh_agent when pub+priv key are None, not based on the class --- pygit2/remote.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pygit2/remote.py b/pygit2/remote.py index 81c1ebd..9e4957e 100644 --- a/pygit2/remote.py +++ b/pygit2/remote.py @@ -456,11 +456,10 @@ def get_credentials(fn, url, username, allowed): to_bytes(passwd)) elif cred_type == C.GIT_CREDTYPE_SSH_KEY: - if isinstance(creds, KeypairFromAgent): - username = creds.credential_tuple[0] - err = C.git_cred_ssh_key_from_agent(ccred, to_bytes(username)) + name, pubkey, privkey, passphrase = creds.credential_tuple + if pubkey is None and privkey is None: + err = C.git_cred_ssh_key_from_agent(ccred, to_bytes(name)) else: - name, pubkey, privkey, passphrase = creds.credential_tuple err = C.git_cred_ssh_key_new(ccred, to_bytes(name), to_bytes(pubkey), to_bytes(privkey), to_bytes(passphrase))