Alexandr Alexandr - 1 year ago 156
Git Question

How to check if credentials valid on a remote repository with LibGit2Sharp library

I am working with LibGit2Sharp lib and i need to ping a remote and check if provided credentials valid.

Most of the samples provided here require a local folder to create a Repository object. I think it is not best practice to create tmp folder and then try to fetch data.

Answer Source

You could try to retrieve the list of remote references of the distant repository through the static Repository.ListRemoteReferences() method.

This would not download the content of the repository on your disk as everything would be dealt with in memory.

See the CanListRemoteReferencesWithCredentials() unit test for additional help regarding usage.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download