I'm trying to use the library "libgit2sharp" to clone a repository via a SSH key and... I can't find anything... I can clone it via "https" but what I'd like to do is using an SSH key. It's really unclear if it is supported or not.
标签:
libgit2sharp
相关问题
- Download one file from remote (git show) using lib
- Git stash on windows extremly slow compared to Lib
- How to get the current/active branch with LibGit2S
- Git repository internal format explained
- Best way to do parallel stages?
相关文章
- How to get the current/active branch with LibGit2S
- Git repository internal format explained
- Best way to do parallel stages?
- LibGit2Sharp: Fetching fails with “Too many redire
- 如何轻松搞定所有参考文献为指定的提交?(How to easily get all Refs for
- LibGit2Sharp拿到后拉库的变化(LibGit2Sharp get repository c
- 我怎么能忽略LibGit2Sharp一个特定的文件,当我从一个分支合并到另一个?(How can I
- 编程方式删除克隆库的目录(Programmatically delete directory of
As of now, there is a SSH implementation using libssh2 library. You can find it here LibGit2Sharp - SSH
You should add libgit2sharp-ssh dependency on you Project to be able to use it. It is available as a nugget: https://www.nuget.org/packages/LibGit2Sharp-SSH
Disclaimer: I haven't found a formal usage guide yet, what I know is from putting together bits and pieces from other user questions through LibGit2 forums.
From what I understood, you would need to create a new credential using eitherSshUserKeyCredentials OR SshAgentCredentials to authenticate using SSH, and pass it as part of CloneOptions.
In the sample code I use "git" as user, simply because the remote would be something like git@bitbucket.org:project/reponame.git , in which case "git" is the correct user, otherwise you will get an error saying
The code to clone a repo with SSH should be something like that: