LibGit2CS 0.1.5-dev

This is a prerelease version of LibGit2CS.
dotnet add package LibGit2CS --version 0.1.5-dev
                    
NuGet\Install-Package LibGit2CS -Version 0.1.5-dev
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LibGit2CS" Version="0.1.5-dev" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LibGit2CS" Version="0.1.5-dev" />
                    
Directory.Packages.props
<PackageReference Include="LibGit2CS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LibGit2CS --version 0.1.5-dev
                    
#r "nuget: LibGit2CS, 0.1.5-dev"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LibGit2CS@0.1.5-dev
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LibGit2CS&version=0.1.5-dev&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=LibGit2CS&version=0.1.5-dev&prerelease
                    
Install as a Cake Tool

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

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 Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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