libgit2/pygit2 — pull request #398 by djmattyg007 (2014-08-10 02:51:43+00:00)
Title: Format of public key and private key for the Keypair class

I've spent almost an hour trying to find out what format I should pass the public and private keys in as when using the Keypair class. To me, I would just pass in the path to my private and public keys like so:

myauth = pygit2.Keypair("myusername", "/home/matthew/.ssh/id_rsa.pub", "/home/matthew/.ssh/id_rsa", "mypassword")
repo = pygit2.clone_repository(url="ssh://git@github.com/djmattyg007/modman", path="/tmp/modman", credentials=myauth)

Unfortunately, when I try and run that code, I get this error:

_pygit2.GitError: Failed to authenticate SSH session: Username/PublicKey combination invalid

Am I supposed to read the keys into memory myself from those files and pass those to the Keypair constructor? Am I just getting the username wrong? I can't tell, and the documentation doesn't give any information about this.