-
Notifications
You must be signed in to change notification settings - Fork 894
git fetch
Jason edited this page Jan 15, 2015
·
6 revisions
####Git
$ git fetch origin
```
#### LibGit2Sharp
```csharp
using (var repo = new Repository("path/to/your/repo"))
{
Remote remote = repo.Network.Remotes["origin"];
repo.Network.Fetch(remote);
}
```
### Fetch all remotes, using authentication
####Git
$ git fetch --all
#### LibGit2Sharp
```csharp
using (var repo = new Repository("path/to/your/repo"))
{
foreach(Remote remote in repo.Network.Remotes)
{
FetchOptions options = new FetchOptions();
options.CredentialsProvider = new CredentialsHandler(
(url, usernameFromUrl, types) =>
new UsernamePasswordCredentials()
{
Username = USERNAME,
Password = PASSWORD
});
repo.Network.Fetch(remote, options);
}
}