From 39a50d9d048a0abc5fd5ded6be4339818f169144 Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Tue, 1 Aug 2017 16:56:11 +0200 Subject: [PATCH] Update git-clone-ssh.rst As I understand the `allowed_types` it is a bitmap which should be compared using a logical AND. Further the options `GIT_CREDTYPE_SSH_KEY`and `GIT_CREDTYPE_USERNAME` are defined in `pygit2.credentials`. --- docs/recipes/git-clone-ssh.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/recipes/git-clone-ssh.rst b/docs/recipes/git-clone-ssh.rst index 81e98b5e1..3e2b36ae3 100644 --- a/docs/recipes/git-clone-ssh.rst +++ b/docs/recipes/git-clone-ssh.rst @@ -13,9 +13,9 @@ Example for cloning a git repository over ssh. class MyRemoteCallbacks(pygit2.RemoteCallbacks): def credentials(self, url, username_from_url, allowed_types): - if allowed_types == pygit2.GIT_CREDTYPE_USERNAME: + if allowed_types & pygit2.credentials.GIT_CREDTYPE_USERNAME: return pygit2.Username("git") - elif allowed_types == pygit2.GIT_CREDTYPE_SSH_KEY: + elif allowed_types & pygit2.credentials.GIT_CREDTYPE_SSH_KEY: return pygit2.Keypair("git", "id_rsa.pub", "id_rsa", "") else: return None