ktsu.GitIntegration 1.1.9

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ktsu.GitIntegration --version 1.1.9
                    
NuGet\Install-Package ktsu.GitIntegration -Version 1.1.9
                    
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="ktsu.GitIntegration" Version="1.1.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ktsu.GitIntegration" Version="1.1.9" />
                    
Directory.Packages.props
<PackageReference Include="ktsu.GitIntegration" />
                    
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 ktsu.GitIntegration --version 1.1.9
                    
#r "nuget: ktsu.GitIntegration, 1.1.9"
                    
#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 ktsu.GitIntegration@1.1.9
                    
#: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=ktsu.GitIntegration&version=1.1.9
                    
Install as a Cake Addin
#tool nuget:?package=ktsu.GitIntegration&version=1.1.9
                    
Install as a Cake Tool

ktsu.GitIntegration

A .NET library that unifies access to hosted Git providers behind a single abstraction, with semantic types for Git identifiers.

License NuGet Version NuGet Version NuGet Downloads GitHub commit activity GitHub contributors GitHub Actions Workflow Status

Introduction

ktsu.GitIntegration provides a common surface for talking to hosted Git providers. Instead of writing one code path against Octokit for GitHub and another against the Team Foundation Server client for Azure DevOps, you work against a single GitProvider abstraction and let the concrete implementation deal with authentication and API differences.

Alongside the provider abstraction, the library replaces the stringly-typed values that pervade Git tooling — branch names, commit SHAs, remote names, author emails — with validated semantic types built on ktsu.Semantics. A GitBranchName can no longer be accidentally passed where a GitCommitSha is expected.

Features

  • Provider Abstraction: GitProvider defines a common contract for enumerating and refreshing remote repositories, with concrete implementations per host.
  • GitHub Support: GitHubProvider wraps Octokit and authenticates from cached credentials.
  • Azure DevOps Support: Built on the Microsoft Team Foundation Server and Visual Studio Services clients.
  • Credential Resolution: Integrates with ktsu.CredentialCache, so credentials come from the host's native keyring rather than configuration files.
  • Semantic Git Types: Validated wrappers for the identifiers Git tooling passes around, so mismatched arguments fail at compile time rather than at runtime.
  • Repository Model: GitRepository captures a repository's remote path, web URI, and owner in a strongly-typed form.

Installation

Package Manager Console

Install-Package ktsu.GitIntegration

.NET CLI

dotnet add package ktsu.GitIntegration

Package Reference

<PackageReference Include="ktsu.GitIntegration" Version="x.y.z" />

Usage Examples

Basic Example

using ktsu.GitIntegration;

GitProvider provider = new GitHubProvider();

// Pulls credentials from the credential cache, then authenticates the client.
provider.RefreshRemoteRepositories();

Working with Semantic Types

using ktsu.Extensions;
using ktsu.GitIntegration;

GitBranchName branch = "main".As<GitBranchName>();
GitRemoteName remote = "origin".As<GitRemoteName>();
GitCommitSha sha = "9fceb02d0ae598e95dc970b74767f19372d61af8".As<GitCommitSha>();

// These are distinct types — passing a GitBranchName where a GitCommitSha
// is expected is a compile error, not a runtime surprise.

Opening a Repository in the Browser

using ktsu.GitIntegration;

GitRepository repository = /* obtained from a provider */;
repository.OpenWebClient();

API Reference

GitProvider

Abstract base class describing a hosted Git provider.

Properties
Name Type Description
Name GitProviderName Display name of the provider.
Methods
Name Return Type Description
RefreshRemoteRepositories() void Refreshes the provider's view of the remote repositories, authenticating first if a credential is available.
TryGetCredential(out Credential?) bool Attempts to resolve a credential for this provider from the credential cache.

GitHubProvider

GitProvider implementation backed by Octokit. Authenticates the underlying GitHubClient from a CredentialWithUsernamePassword resolved via TryGetCredential.

GitRepository

Strongly-typed representation of a repository on a remote host.

Methods
Name Return Type Description
OpenWebClient() void Opens the repository's web URI in the default browser.

Semantic Types

Type Wraps
GitAuthorEmail Commit author email address
GitAuthorName Commit author name
GitBranchName Branch name
GitCommitMessage Commit message
GitCommitSha Commit hash
GitProviderGUID Provider-assigned unique identifier
GitProviderName Provider display name
GitProviderOwner Account or organization owning a repository
GitRefName Fully qualified ref name
GitRemoteName Remote name
GitRepositoryName Repository name
GitRepositoryRemotePath Clone path or URL
GitRepositoryWebURI Repository web address
AzureDevOpsProjectName Azure DevOps project name

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
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
2.5.3 95 8/26/2026
2.5.2 100 8/26/2026
2.5.1 92 8/25/2026
2.5.0 94 8/25/2026
2.4.0 258 8/20/2026
2.3.0 99 8/20/2026
2.2.1 103 8/20/2026
2.2.0 100 8/20/2026
2.1.0 108 8/20/2026
2.0.0 94 8/19/2026
1.1.9 92 8/19/2026
1.1.8 95 8/18/2026
1.1.7 111 8/17/2026
1.1.6 100 8/11/2026
1.1.5 94 8/6/2026
1.1.4 102 8/5/2026
1.1.3 129 6/28/2026
1.1.2 112 6/28/2026
1.1.2-pre.18 227 5/20/2025
1.1.2-pre.15 175 5/17/2025
Loading failed

## v1.1.9 (patch)

Changes since v1.1.8:

- chore: store icon.png in LFS as .gitattributes declares ([@matt-edmondson](https://github.com/matt-edmondson))
- docs: scope build badge to the default branch ([@matt-edmondson](https://github.com/matt-edmondson))
- docs: broaden TAGS.md for better topic coverage ([@matt-edmondson](https://github.com/matt-edmondson))
- docs: correct README, DESCRIPTION and TAGS metadata ([@matt-edmondson](https://github.com/matt-edmondson))