Reputation: 1520
I would like to use libgit2sharp to run the equivalent of ls-remote for a remote not currently cloned on my system, the equivalent of:
git ls-remote http://www.kernel.org/pub/scm/git/git.git
In the tests, they all seem to begin with a repository cloning the remote, but I do not want to perform the clone just yet. I just want to make sure that I can communicate with the server.
I found this issue which talks about the same thing in the underlying library, but since there was no response yet, I wasn't sure if there is a way to do this or not?
Thanks!
Upvotes: 1
Views: 478
Reputation: 985
It can simply be done using the ListRemoteReferences
method on Repository
.
See the example below:
CredentialsHandler handler = (url, usernameFromUrl, types) =>
{
return new UsernamePasswordCredentials()
{
Username = "username",
Password = "password"
};
};
var references = Repository.ListRemoteReferences(myRepoUrl, handler);
Upvotes: 0