>>>
>>> git_host = 'githost.com'
>>> org = 'myorg'
>>> repo = 'testgitpull'
>>>
>>> keypair = pygit2.Keypair("git", 'TESTGIT.pub', 'TESTGIT', "icanhazgit")
>>> callbacks = pygit2.RemoteCallbacks(credentials=keypair)
>>> r = pygit2.clone_repository("ssh://git@%s/%s/%s" % (git_host, org, repo), "testgitpull", callbacks=callbacks)
>>>
>>> print r
pygit2.Repository('https://github.com/home/mew1033/testgit/testgitpull/.git/')
>>>
>>>
(I deleted the folder here so that it could clone again)
>>>
>>> with open('TESTGIT.pub', 'r') as f:
... pub = f.read()
...
>>> with open('TESTGIT', 'r') as f:
... priv = f.read()
...
>>>
>>>
>>> keypair = pygit2.KeypairFromMemory("git", pub, priv, "icanhazgit")
>>> callbacks = pygit2.RemoteCallbacks(credentials=keypair)
>>> r = pygit2.clone_repository("ssh://git@%s/%s/%s" % (git_host, org, repo), "testgitpull", callbacks=callbacks)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "https://github.com/usr/lib64/python2.7/site-packages/pygit2/__init__.py", line 263, in clone_repository
check_error(err)
File "https://github.com/usr/lib64/python2.7/site-packages/pygit2/errors.py", line 64, in check_error
raise GitError(message)
_pygit2.GitError: err -7 (no message provided)
>>>
>>>
I'm follwing the git clone via ssh example here: http://www.pygit2.org/recipes/git-clone-ssh.html (Just the second half). It's working fine when my keys are stored in files, but when I try to use the public key stored in memory option, it fails. Here's what I've done: