Repository navigation
git-rg v0.4.0
git-rg v0.4.0
v0.4.0 makes existing gh and glab logins usable by default for remote search and ref listing, while keeping environment tokens as the first choice and preserving an anonymous fallback.
English
Automatic credentials
- Search and
refsnow default to--auth auto: non-empty existing environment tokens are used first, then the current account fromghorglabis reused for the matching host. - Use
--auth envto disable CLI credential lookup. No new credential store, login command, dependency, or token CLI flag was added. - GitHub uses
gh auth token --hostname HOST. GitLab checksglab auth status --hostname HOST, then reads the access credential throughglab auth git-credential get. PAT and OAuth access tokens are sent asAuthorization: Bearer; CI job tokens and malformed helper output are rejected. - Automatic lookup is limited to HTTPS repositories whose API origin matches the repository origin, including the GitHub
github.comtoapi.github.commapping and same-origin custom API paths. Insecure or cross-origin API overrides skip helper lookup and emit a warning. - Helper execution is non-interactive, runs in an isolated temporary directory, keeps the token in memory, and caps combined stdout/stderr at 64 KiB per helper invocation. The helper phase is limited to 10 seconds within the command
--timeout. - If the CLI is not installed, gitrg silently continues anonymously. An unavailable, timed-out, or invalid installed helper produces one
auth_unavailablewarning and continues anonymously. An API authentication failure never triggers an anonymous or alternate-identity retry. Requests made byglabfor status or OAuth refresh are not counted in gitrg's--max-requestsbudget.
The hidden glab credential helper must be supported by the installed version and its credential store. OAuth refresh and any resulting credential persistence remain managed by glab; git-rg does not implement either. Upgrade incompatible glab versions or use an environment token with --auth env.
Release assets
The release contains six Tier 1 archives, install.sh, install.ps1, and checksums.txt:
git-rg_v0.4.0_linux_amd64.tar.gz, git-rg_v0.4.0_linux_arm64.tar.gz, git-rg_v0.4.0_darwin_amd64.tar.gz, git-rg_v0.4.0_darwin_arm64.tar.gz, git-rg_v0.4.0_windows_amd64.zip, and git-rg_v0.4.0_windows_arm64.zip.
Each archive contains one top-level version directory and one platform binary. checksums.txt covers all six archives and both installers; verify it before extraction or execution. See installation.md for installation and rollback procedures.
Verification
Local validation passed on OrbStack Linux arm64 with Go 1.26.1: go test -race ./..., go vet ./..., and go build ./.... A host smoke run with the real macOS gh keyring login also completed successfully against a public GitHub repository. Real glab login and GitLab OAuth refresh were not available for local validation. Published build and installation checks are available in the Release workflow.
中文
自动复用凭证
- 搜索和
refs现在默认使用--auth auto:先使用已有的非空环境变量 token,再复用目标站点对应账号的gh或glab登录。 - 使用
--auth env可关闭 CLI 凭证读取。没有新增凭证存储、登录命令、依赖或 token CLI 参数。 - GitHub 调用
gh auth token --hostname HOST。GitLab 先检查glab auth status --hostname HOST,再通过glab auth git-credential get读取访问凭证。PAT 和 OAuth access token 统一使用Authorization: Bearer;CI job token 和格式异常的 helper 输出会被拒绝。 - 自动读取仅适用于仓库与 API 都使用 HTTPS 且 origin 匹配的情况,包括 GitHub
github.com到api.github.com的映射,以及同 origin 的自定义 API 路径。非 HTTPS 或跨 origin 的 API 覆盖会跳过 helper 并发出 warning。 - helper 以非交互方式在独立临时目录运行,token 只保留在内存中,每次 helper 调用的 stdout/stderr 合计上限为 64 KiB。helper 阶段最多 10 秒,并计入命令的
--timeout。 - 未安装 CLI 时,gitrg 会静默匿名继续。已安装的 helper 不可用、超时或输出无效时只发出一次
auth_unavailablewarning,然后匿名继续。API 认证失败不会切换到匿名身份或其他身份重试。glab 的状态检查和 OAuth 刷新请求不计入 gitrg 的--max-requests预算。
所安装的 glab 版本及其凭证库必须支持隐藏的 credential helper。OAuth 刷新及其产生的凭证持久化仍由 glab 管理,git-rg 不实现这两项行为。版本不兼容时请升级 glab,或通过 --auth env 使用环境变量 token。
发布资产
Release 包含六个 Tier 1 平台 archive、install.sh、install.ps1 和 checksums.txt:
git-rg_v0.4.0_linux_amd64.tar.gz、git-rg_v0.4.0_linux_arm64.tar.gz、git-rg_v0.4.0_darwin_amd64.tar.gz、git-rg_v0.4.0_darwin_arm64.tar.gz、git-rg_v0.4.0_windows_amd64.zip 和 git-rg_v0.4.0_windows_arm64.zip。
每个 archive 包含一个顶层版本目录和一个平台可执行文件。checksums.txt 覆盖六个 archive 和两个安装器;解压或执行前请先校验。安装和回滚流程见 installation.md。
验证
已在 OrbStack Linux arm64、Go 1.26.1 上通过本地验证:go test -race ./...、go vet ./... 和 go build ./...。使用本机真实 macOS gh keyring 登录对公开 GitHub 仓库执行的 smoke 也成功。由于本机没有 glab,真实 glab 登录和 GitLab OAuth 刷新尚未验证。发布构建与安装验收结果见 Release workflow。
完整变更记录:v0.3.0...v0.4.0