libgit2-rs implementing "git pull"


#1

Hey there,
I’m currently building a tool that integrates git functionality.
Has anybody implemented a fetch or pull with libgit2-rs that accesses an ssh remote?
the callback RemoteCallbacks::credentials() doesn’t seem to be the right one.


#2

You can take a look at Cargo’s implementation as it implements pulling from an ssh remote, but RemoteCallbacks::credentials should be what you need to use here. Unfortunately the handshake involves something like returning a username authentication first followed by some ssh-key authentication.


#3

Thanks for the hint, I’ll have a look at the cargo implementation than.


#4

I finally had the time to take a look at what you did in with_authentication in cargo.
It seems to me that a lot of what you did in cargo’s git/utils.rs could be very beneficial to the git2 crate instead. What is your opinion?


#5

Perhaps! git2-rs is currently just a thin wrapper around libgit2, but I wouldn’t mind beefing up the docs with more practical examples or perhaps adding helper functions here or there.