Copy from gogs git module. https://github.com/gogs/git-module
Package cassie-git-module is a .NET standard 2.0 module for Git access through shell commands.
- C# version must be at least 8.0.
- Git version must be no less than 1.8.3. License This project is under the MIT License. See the LICENSE file for the full license text.
dotnet add package cassie-git-module --version 0.8.3.2
var repo = new Repository();
await repo.Init(path,new InitOptions{Timeout=20,Bare=true});
var repo = new Repository();
await repo.Clone(url,dest,new CloneOptions{Timeout=20});
var repo = new Repository([Your Repo Path]);
await repo.Fetch(new FetchOptions{Timeout=20});
var repo = new Repository([Your Repo Path]);
await repo.Pull(new PullOptions{Timeout=20});
var repo = new Repository([Your Repo Path]);
await repo.Push(new PullOptions{Timeout=20});
var repo = new Repository([Your Repo Path]);
await repo.Push(remote,branch,new PushOptions{Timeout=20});
var repo = new Repository([Your Repo Path]);
await repo.Checkout(branch,new CheckoutOptions{Timeout=20});
...
For details, You can reference the assie.git.module.test project to use this SDK.