Skip to content

unable to clone using SSH with RSA key pair #836

@ExpandingMan

Description

@ExpandingMan

Hello, I was having a problem in the Julia libgit2 wrapper wherein I couldn't clone repos using the SSH protocol with a key pair. So, I installed pygit2 to see if I'd have the same problem and, lo and behold, it doesn't seem to be working.

I'm trying to clone with this script:

keypair = pygit2.Keypair("git", "id_emgitlab.pub", "id_emgitlab", "")
callbacks = pygit2.RemoteCallbacks(credentials=keypair)
pygit2.clone_repository(repo_url, "testrepo", callbacks=callbacks)

(repo_url is indeed the SSH link, not sure if it's still called a url).

It hangs for a really long time and then returns the following stack trace:

GitError                                  Traceback (most recent call last)
~/testpull.py in <module>()
      7 callbacks = pygit2.RemoteCallbacks(credentials=keypair)
      8 
----> 9 pygit2.clone_repository(repo_url, "testrepo", callbacks=callbacks)

/usr/lib/python3.7/site-packages/pygit2/__init__.py in clone_repository(url, path, bare, repository, remote, checkout_branch, callbacks)
    261         raise d['exception']
    262 
--> 263     check_error(err)
    264 
    265     return Repository._from_c(crepo[0], owned=True)

/usr/lib/python3.7/site-packages/pygit2/errors.py in check_error(err, io)
     62 
     63     # Generic Git error
---> 64     raise GitError(message)
     65 
     66 # Indicate that we want libgit2 to pretend a function was not set

GitError: Failed to authenticate SSH session: Unable to send userauth-publickey request

I've tried many different configurations of file permissions on the keys (though most of them not for the Python pull).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions