ktsu.GitIntegration
2.0.0
Prefix Reserved
See the version list below for details.
dotnet add package ktsu.GitIntegration --version 2.0.0
NuGet\Install-Package ktsu.GitIntegration -Version 2.0.0
<PackageReference Include="ktsu.GitIntegration" Version="2.0.0" />
<PackageVersion Include="ktsu.GitIntegration" Version="2.0.0" />
<PackageReference Include="ktsu.GitIntegration" />
paket add ktsu.GitIntegration --version 2.0.0
#r "nuget: ktsu.GitIntegration, 2.0.0"
#:package ktsu.GitIntegration@2.0.0
#addin nuget:?package=ktsu.GitIntegration&version=2.0.0
#tool nuget:?package=ktsu.GitIntegration&version=2.0.0
ktsu.GitIntegration
A .NET library that unifies access to hosted Git providers behind a single abstraction, with semantic types for Git identifiers.
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:
GitProviderdefines a common contract for enumerating and refreshing remote repositories, with concrete implementations per host. - GitHub Support:
GitHubProviderwraps 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:
GitRepositorycaptures 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 | Versions 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. |
-
net10.0
- ktsu.CredentialCache (>= 1.3.21)
- ktsu.Essentials (>= 2.0.0)
- ktsu.Essentials.FileSystemProviders.Native (>= 2.0.0)
- ktsu.RunCommand (>= 1.5.0)
- ktsu.Semantics.Paths (>= 3.0.1)
- ktsu.Semantics.Strings (>= 3.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.2)
- Octokit (>= 14.0.0)
-
net9.0
- ktsu.CredentialCache (>= 1.3.21)
- ktsu.Essentials (>= 2.0.0)
- ktsu.Essentials.FileSystemProviders.Native (>= 2.0.0)
- ktsu.RunCommand (>= 1.5.0)
- ktsu.Semantics.Paths (>= 3.0.1)
- ktsu.Semantics.Strings (>= 3.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.2)
- Octokit (>= 14.0.0)
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 | 259 | 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 | 110 | 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 |
## v2.0.0 (major)
Changes since v1.1.9:
- [patch] Stop the timeout tests depending on host process speed ([@matt-edmondson](https://github.com/matt-edmondson))
- Merge origin/main into feature/gitintegration-v2 ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Force a non-interactive English git environment via RunCommand 1.5.0 ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Adopt ktsu.RunCommand 1.4.29 cancellation fix ([@matt-edmondson](https://github.com/matt-edmondson))
- [major] Mark GitIntegration v2 as a breaking release ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Refresh spec to match implemented code and upstream fixes ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Trim unused API surface and package references ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Close test-integrity gaps in the execution core ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Remove all three analyzer suppressions ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Fix required owner, timeout race, SHA-256 ids, and result aliasing ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Add extension seams, a progress path, and an options snapshot ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Close shell-execute and git option injection holes ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Add tests for single-instance guarantee and idempotent options ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Add dependency injection registration for git integration ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Narrow AppendVerbArguments to ICollection<string> instead of suppressing CA1002 ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Use ICollection in AppendVerbArguments signature in plan ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Add git command builder base with global argument injection ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Document RunCommand cancellation race in spec constraints ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Classify raced git timeouts alongside faulted ones ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Distinguish git timeout from caller cancellation ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Add GitTimeoutException to spec and plan ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Add RunCommand-backed git process runner ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Fix default-instance and exit-code traps in GitResult and GitCommandException ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Correct GitResult default-state trap and ExitCode sentinel in spec and plan ([@matt-edmondson](https://github.com/matt-edmondson))
- Revert "[patch] Ignore superpowers SDD scratch workspace" ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Add git execution contract, result and exception types ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Make repository metadata nullable and fix cross-platform browser launch ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Correct line-ending constraint to match repo .gitattributes ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Migrate semantic types from StrongStrings to Semantics ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Swap package manifest to Semantics and add test project ([@matt-edmondson](https://github.com/matt-edmondson))
- [patch] Ignore superpowers SDD scratch workspace ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Add GitIntegration v2 phase 1-2 implementation plan ([@matt-edmondson](https://github.com/matt-edmondson))
- [minor] Add GitIntegration v2 design spec ([@matt-edmondson](https://github.com/matt-edmondson))