Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occuring when trying to clone github repo with SSH credentials using rugged #347

Closed
gabriel403 opened this issue Apr 6, 2014 · 11 comments

Comments

@gabriel403
Copy link

When trying to clone a remote repo with Rugged, I keep getting the error
Failed to authenticate SSH session: Unable to open public key file

I add my ssh credentials fine, but when I come to doing the clone the above error occurs.

cred = Rugged::Credentials::SshKey.new({username: 'gabriel403', publickey: publickey, privatekey: privatekey})
Rails.logger.debug cred

Where publickey and privatekey are string holding the keys.

repo = Rugged::Repository.clone_at('[email protected]:gabriel403/dotfiles.git', '/tmp/dotfiles', {credentials: cred})
Rails.logger.debug repo
@arthurschreiber
Copy link
Member

publickey and privatekey need to be the paths to your key files, not the key contents.

@gabriel403
Copy link
Author

Gah! Is it not possible with strings or StringIO?

@arthurschreiber
Copy link
Member

Nope, it's a limitation we inherit from libgit2. You should open an issue in the libgit2 repo.

@gabriel403
Copy link
Author

Tempfile to the rescue

@arthurschreiber
Copy link
Member

Yeah, or that. 👍

@gabriel403
Copy link
Author

@boblail
Copy link

boblail commented Jul 10, 2015

It is now possible to pass a keypair via a buffer instead of a path. For this, GIT_CREDTYPE_SSH_MEMORY and git_cred_ssh_key_memory_new() have been added.

It looks like support for this was added to libgit2 in 0.23.0

@arthurschreiber
Copy link
Member

I'll add support for this asap.

@gabriel403
Copy link
Author

💖

@boblail
Copy link

boblail commented Jul 11, 2015

🌟 thanks!

@arthurschreiber
Copy link
Member

@gabriel403 @boblail Check out #501. It will only work with very recent versions of libssh2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants