LibGit2CS 0.1.5-dev
dotnet add package LibGit2CS --version 0.1.5-dev
NuGet\Install-Package LibGit2CS -Version 0.1.5-dev
<PackageReference Include="LibGit2CS" Version="0.1.5-dev" />
<PackageVersion Include="LibGit2CS" Version="0.1.5-dev" />
<PackageReference Include="LibGit2CS" />
paket add LibGit2CS --version 0.1.5-dev
#r "nuget: LibGit2CS, 0.1.5-dev"
#:package LibGit2CS@0.1.5-dev
#addin nuget:?package=LibGit2CS&version=0.1.5-dev&prerelease
#tool nuget:?package=LibGit2CS&version=0.1.5-dev&prerelease
LibGit2CS
A managed C# port of libgit2 1.9.4 for reading and writing Git repositories, inspecting history and diffs, and working with remotes. No native libgit2 installation is needed; filesystem operations can use platform OS APIs.
Install
This package targets .NET 11. Review the compatibility guide for requirements and limitations.
dotnet add package LibGit2CS --prerelease
Pin the package version validated by your application. XML API documentation is included for IDE IntelliSense.
Open a repository
Use this as Program.cs in a .NET 11 console application with implicit usings.
Pass an existing repository path as the first command-line argument:
using LibGit2CS.Core;
using LibGit2CS.Repository;
using var cancellation = new CancellationTokenSource();
CancellationToken ct = cancellation.Token;
using var context = new GitContext();
await using var repo = await GitRepository.OpenAsync(args[0], context, ct);
var head = await repo.HeadAsync(ct);
Console.WriteLine(head is null ? "HEAD is unborn or missing." : head.Name);
GitContext owns settings and registries. Dispose repositories before their
context. HeadAsync returns null for an unborn or missing HEAD.
Learn more
- Getting started
- Ownership, cancellation, errors, and bytes
- Reading history and objects
- Status and diffs
- Staging and commits
- Remotes and authentication
- Source repository
These links describe the current main branch. The package includes its
corresponding library source, build inputs, and guides under src/; consult
those for the version you installed. To rebuild, extract the package and follow
src/docs/development.md under “Building the packaged source”.
License
LibGit2CS is distributed under GPL version 2 only with the libgit2 linking exception. Independently developed files explicitly marked MIT retain that license; the entire library is not offered under MIT. Dependencies retain their own licenses. The package includes the complete LICENSE and third-party notices.
See the license and attribution.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- LibSsh2CS (>= 0.2.2-dev)
- System.IO.Hashing (>= 10.0.11)
- Xdiff (>= 1.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.5-dev | 56 | 10/10/2026 |