niu-git

Native Windows Git, no MSYS: the real git-for-windows C sources built with MSVC — no bundled bash, no bundled perl, no bundled OpenSSL; TLS goes through schannel and the Windows certificate store. The git on PATH is git itself, git --version starts in about 14 ms, and the scripted parts (hooks, bisect, mergetool) run on niubash's sh.

C (MSVC) Windows stable

github.com/unixwin/niu-git ↗ · Star 0 · latest v2.56.0.1 (repo-meta, measured 2026-10-19; no releases page — the tag is the version)

Why niu-git

Nearly everyone on Windows has a git on PATH that "boots an MSYS2 runtime before doing work": calling from cmd / PowerShell hops through the cmd\git.exe launcher, calling from Git Bash pays an extra fork — so every git status pays tax for a POSIX world you don't need. niu-git's stance is plain: the git binary is a C program, so build it natively as one; git's scripted parts are shell, so hand them to a real shell.

中文原文 · Chinese original(4 张卡片全文)
  • 快是结构性的,不是调优——Git Bash 的 git 跑在 MSYS2 运行时里,每次调用都付一遍 POSIX 运行时初始化;niu-git 的 usr\bin\git.exe 就是 git 本体:一次 CreateProcess,无 MSYS DLL、进程树里无 bash 无 perl。
  • 无 MSYS、无 OpenSSL、无捆绑脚本运行时——MSVC + CMake 构建 git-for-windows 真实 C 源码;TLS 只走 schannel;zlib / iconv 静态链接;shell 脚本部分由 PATH 上的 niubash sh 承担。
  • 参数保真:引号纪律与消息字面字节——commit -m 载荷、D:\dir\ 路径规格、CJK 与多行消息逐字节存活;差分套件 49/49 钉死;消息载荷永不改写。
  • 边界诚实:不带的说清楚——perl 命令(send-email、svn、cvs*)不提供而不是运行时才失败;git-gui / gitk 不随发;git grep -P 没有——用 WinuxCmd 的 grep -P。

Core features

Real git C sources, natively built with MSVC; ~14 ms startup; schannel TLS with credential helpers untouched; a clean division of labor with niubash's sh; an upstream test baseline on record; and it arrives together with niubash. Full six-point list (Chinese):

中文原文 · Chinese original(六条特性全文)
  • 真 git C 源码,MSVC 原生构建——上游 git-for-windows 的 C 源码 + 仓内三枚补丁(#1 schannel 容忍 stale http.sslBackend;#2 POSIX 形路径参数 + 消息守卫;#3 system prefix 自定位),源码永不入仓,CI 拉上游 tarball 打补丁。
  • ~14 ms 启动——wpm flat 布局实测 git --version 13.7 ms 均值;v2.55.0.5 起根入口 launcher 退役,无包装 hop。
  • schannel TLS 与凭据不越权——TLS 走 Windows 证书库;自配的任何凭据 helper 照常生效;系统 gitconfig 刻意不设默认 helper;自带 172 KB 的 wincred 小助手。
  • 与 niubash sh 的分工——hooks、git bisect、git mergetool、git filter-branch、git submodule、git request-pull 跑在 niubash 提供的 sh 上。
  • 上游测试基线在案——curated subset 2861 ok / 14 例 # TODO known breakage / 0 硬失败;t0001-init 102/103。
  • 随 niubash 一起到货——niubash 1.4.0 的 Windows 发行包经 wpm 预装 niu-git(ARM64 同样预装)。

Install & quick start

Windows: the niubash release package already preloads niu-git (the bundle list lives in niubash's scripts/release/preinstall.json; niu-git and gawk are windows-x64 assets, the ARM64 leg ships only ripgrep and fd per the preinstall.json notes). Verify:

git --version

Migrating from a MinGit shim install (the flat layout needs WinuxCmd/wpm 1.1.9+):

wpm update winuxcmd
wpm install niugit --force

One-line first-run check: git --version should print a version string of the 2.56.0.windows.2.niugit shape — upstream suffix and the niu-git distro marker both present. niubash users can skip this: the Windows package already ships niu-git (x64 and ARM64).

Deep dive: speed, the native toolchain and sh interplay

Speed comparison

Windows x64, warm cache, Python subprocess timing, 15 rounds, a small repo (measured 2026-10). The gap is structural: niu-git reaches the git binary in one CreateProcess; the Git Bash side pays MSYS2 runtime initialization per call (plus a fork inside the prompt).

git on PATHgit --versiongit status --porcelain
niu-git (flat layout) 13.7 ms mean / 11.5 ms min 22.6 ms mean / 17.4 ms min
Git for Windows mingw64\bin\git.exe 51.3 ms mean 30.6 ms mean
Git for Windows cmd\git.exe (the usual PATH entry) 45.3 ms mean 50.1 ms mean
time git … inside the Git Bash prompt 73–103 ms real —
中文原文 · Chinese original(MSVC / schannel 与 sh 联动 两节全文)

MSVC / schannel:原生工具链到底——构建链是 MSVC + CMake(+ vcpkg),TLS 只编 schannel:证书与系统更新走 Windows 证书库,不携带 OpenSSL 及其随附 dll;zlib 与 iconv 静态链接。patch #1 容忍遗留的 http.sslBackend 配置——警告并回落,而不是拒绝启动。

与 niubash sh 联动——git 的脚本面不是被删掉,是被分工:hooks、git bisect、git mergetool、git filter-branch、git submodule、git request-pull 交给 PATH 上的 sh(即 niubash 的 sh shim)。perl 依赖的 send-email / svn / cvs* 诚实缺席;git grep -P 没有时用 WinuxCmd 的 grep -P。路径方言总账见 路径与 MSYS。

Measured numbers

Metricniu-gitContrastSource
git --version 13.7 ms mean / 11.5 ms min (~14 ms) Git Bash 45–103 ms niu-git README Speed table (measured 2026-10)
git status --porcelain 22.6 ms mean / 17.4 ms min GfW cmd\git.exe 50.1 ms mean same table
Install size bundle 29 MB / zip 33 MB MinGit zip 37 MB niu-git README Status section
Upstream t/ suites (curated subset) 2861 ok / 0 hard failures 14 # TODO known breakage entries niu-git README Test section
Launcher quoting differential 49/49 pass — niu-git PR #6 · test-launcher.py

Release feed

VersionDateSummary
v2.56.0.1 — Latest tag: upstream baseline advanced to git 2.56.0.windows.2; git --version carries the 2.56.0.windows.2.niugit distro marker (repo-meta, measured 2026-10-19; no releases page — the tag is the version).
v2.55.0.5 — Dispatcher retired: patch #3 self-location maps the real mingw64/bin/git.exe straight onto usr\bin\git.exe — wpm flat measures 13.7 ms mean for git --version, 22.6 ms for git status; wpm/niugit.json is this version's index entry (sha256/size aligned with the local build).
v2.55.0.windows.2 — Phase 0 PoC finalized: git-for-windows v2.55.0.windows.2 built with MSVC + CMake + vcpkg, zlib/iconv static, bundle 29 MB; init/add/commit/log/status, schannel https clone, and hooks via the PATH sh all verified.

niu-git is outside changelogs.json's fetch scope (no releases page, no CHANGELOG — the tag is the version, per the FACTS.json products ruling); the table above summarizes the in-repo README, wpm/niugit.json and portal repo-meta tag measurements. Other repos' full feed: changelog.

On this site

Off site

FAQ

How is niu-git different from Git for Windows?

The same git-for-windows C sources built natively with MSVC: no MSYS layer, no OpenSSL (TLS via schannel + the Windows cert store), no bundled shell/perl — launcher quoting follows the Win32 documentation with zero heuristics.

Why is niu-git fast?

git starts in about 14 ms (Git Bash measures 45–103 ms) — no DLL loading or MSYS init chain, the process starts directly.

How do I install niu-git?

It is preinstalled with niubash (x64 / arm64): git --version works out of the box, and POSIX-shaped /d/... arguments are accepted.

How is niubash different from Git Bash / WSL?

niubash is a native Windows program written in Rust: no bundled MSYS emulation layer, no WSL VM. Git Bash heuristically rewrites path-looking arguments before spawn (the reason the MSYS_NO_PATHCONV incantation exists); niu passes argv through byte-for-byte. The installed family is ≈16 MB versus Git Bash's ~440 MB.

How is the performance?

One-shot execution (niu -c true) is 19.8 ms after dedicated optimization; niu-git starts in ~14 ms (Git Bash: 45–103 ms); command-substitution and subshell workloads run 13–62x faster than GNU bash. Every number ships with its measurement method and reproducible artifacts — see Benchmarks (/benchmarks/).