Skip to content

Introduce SSH functionality #1072

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

Closed
wants to merge 1 commit into from
Closed

Introduce SSH functionality #1072

wants to merge 1 commit into from

Conversation

Therzok
Copy link
Member

@Therzok Therzok commented Jun 4, 2015

Added SshAgentCredentials for querying ssh-agent, SshUserKeyCredentials
for authenticating with a given ssh key-pair.

Introduced UsernameQueryCredentials which returns the supported credential
types.

Authentication exceptions are now translated from libgit2.

Supersedes #852

@Therzok
Copy link
Member Author

Therzok commented Jun 4, 2015

Taking some important bits into discussion:

  • libgit2 removed support for libssh2 embedding. What is the best way to make cmake look for libssh2 in a relative directory if it's not installed system-wide?

  • I'll have to update nativebinaries scripts to be able to deploy these things once I find out the above. So we can ship libssh2 + libgit2 binaries in one package! =D

  • We need some test on these things. Taken from previous PR:

    The ssh tests are a bit of a hassle to set up, but you can copy the code from libgit2's Travis script. I would recommend having at least one test run there to make sure basic functionality doesn't get broken.

  • Once we have a combination of packages, we can test both without and with SSH support, by conditionally checking that things throw a InvalidOperationException (probably should be a NotSupportedException) on querying SSH credentials when native binaries don't have support for that.

@Therzok
Copy link
Member Author

Therzok commented Jun 4, 2015

cc @nulltoken

@Therzok
Copy link
Member Author

Therzok commented Jul 8, 2015

I'll rebase this as soon as possible. And I would like to have this reviewed though.

Added SshAgentCredentials for querying ssh-agent, SshUserKeyCredentials
for authenticating with a given ssh key-pair.

Introduced UsernameQueryCredentials which returns the supported credential
types.

Authentication exceptions are now translated from libgit2.
@dannyzhan
Copy link

Hi Guys, how's going with ssh support in libgit2sharp?
I really need this feature in my project.
Thanks!

@Therzok
Copy link
Member Author

Therzok commented Aug 27, 2015

@nulltoken It's rebased atm. The only problem is getting the libssh2 native binaries alongside libgit2 ones.

@carlosmn
Copy link
Member

That part is what https://github.com/carlosmn/libgit2sharp/tree/cmn/managed-ssh was trying to bridge by not needing libssh2, but it would require our own version of the ssh library currently.

@Therzok
Copy link
Member Author

Therzok commented Aug 27, 2015

Going down the route of having that managed ssh implementation can cause some issues such as:

  • We're still shipping a ssh library, so the whole thing is still shipping a dependency (one of your arguments).
  • libssh2 could be compiled to target mobile apps and as a result, making libgit2sharp a PCL could be easier.

This could work for now, I'm not saying no. If a PCL for SSH appears, it's easy to migrate. Just stating the available options.

@carlosmn
Copy link
Member

We wouldn't be the vendors for that library, it's a dependency the same way libssh2 is a dependency. The problems come when we're responsible for the updates, not when we use a library.

Unfortunately there doesn't seem to be an ssh library with active support, so the point may be moot as we'd have to maintain some version of it.

I don't get why having to compile an extra C library would be easier than using managed library for ssh if you wanna run it on a phone, IIRC you can't load native code on Windows Phone anyhow.

@Therzok
Copy link
Member Author

Therzok commented Aug 27, 2015

@carlosmn it all depends on the type of the project. In example, SSH.NET is a simple .NET 4.0 library (as opposed to being a PCL - Portable Class Library), which could then be used as a common library between all the projects you have (WinPhone, Android, iOS, etc). That means, this specific library won't work in a mobile context.

I was working on making LibGit2Sharp a PCL itself, so I could afterwards use it in a mobile application context, and ssh support would come via libssh2.

@CumpsD
Copy link

CumpsD commented Jan 8, 2016

What's the status on this? What exactly is blocking SSH support right now?

@carlosmn
Copy link
Member

There is still no good way to have ssh support in the libgit2 library that comes with the nuget packages. We've spent a lot of time and energy trying to find a solution to us becoming vendors of a crypto library, but so far no solution has presented itself. This has left little time to worry about landing this.

@CumpsD
Copy link

CumpsD commented Jan 12, 2016

Sadly enough, I went with NGit to get SSH working, would've loved to use the cleaner API of libgit2sharp

@EvAlex
Copy link

EvAlex commented Apr 10, 2016

Any updates on this? Crucial feature. The whole library is of no use without it.

@carlosmn
Copy link
Member

SSH support is in the bindings; the shipped libgit2 doesn't because we do not want to ship third-party crypto software in our packages.

If there are missing features from this PR, please open a new one adding that.

@carlosmn carlosmn closed this Apr 20, 2016
@Therzok
Copy link
Member Author

Therzok commented Apr 20, 2016

@carlosmn We should at least surface the API using feature checks.

@carlosmn
Copy link
Member

libgit2 knows whether it was built with ssh support so it'll error out on its own. I'm not a fan of the idea of the bindings doing feature checks themselves.

@EvAlex
Copy link

EvAlex commented Apr 22, 2016

Should there at least be a paragraph with all this info in README.md? I assure you, this matter is not absolutely clear to everyone willing to use this library. It would assist people a lot, if there was some guidance on ssh git checkout.

For myself, I didn't manage to get through and found a workaround with NGit. But that one is so ugly and so very very slow, that I'm not happy at all. Too bad.

@carlosmn
Copy link
Member

Without a description (and a reasonable way) of how to use your own library, I don't know how useful that'd be.

@ssougnez
Copy link

I'm confused... Is it supported or not ? I'm trying to clone a repository using SSH but I really can't find the way to do so. Some comments on the project tends to say it is supported, other say the opposite. Is it possible to have a clear statement on this please?

I really think that issue should be addressed ASAP... Who wants to use password in their code while a SSH key can be used? Without this feature, this awesome library is quite limited.

Thanks a lot for your work

@leobuskin
Copy link

@ssougnez you can use libgit2sharp fork with SSH support based on @Therzok work, available in NuGet under 'LibGit2Sharp-SSH' name.

@rebizu
Copy link

rebizu commented Dec 13, 2016

@leobuskin what version is it a fork of ?

@dannyzhan
Copy link

sadly, I have to use git command directly to support SSH.

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

Successfully merging this pull request may close these issues.

8 participants