ggshield CLI setup
Use this reference when a skill needs ggshield but ggshield --version fails, ggshield api-status fails, or the user needs headless/CI authentication. Return to the active skill once setup verifies successfully.
Setup contract
Run setup in one session before declaring the skill ready:
- Brief the user on why
ggshieldis needed for the active skill. - Install
ggshieldusing the first available path below. - Authenticate with
ggshield auth login. - Verify with
ggshield --versionandggshield api-status.
Pause only when a command must run in the user's own terminal, such as browser-based ggshield auth login, or when every documented fallback is exhausted.
Install ggshield
Start with:
ggshield --versionIf it fails, install ggshield. Order of preference: a package manager first, then the standalone (compiled) build, and the Python package (pip, pipx, uv) only as an absolute last resort. A package manager keeps upgrades automatic; the standalone build carries its own runtime, so it needs no supported Python on the machine and cannot be broken by an externally managed interpreter, a virtualenv, or a later Python upgrade. Probe in this order and use the first path that works.
1. Platform-native package manager (preferred)
These install the standalone build and keep upgrades easy. Detect what the user already has and use the first manager that responds to a --version check.
| Platform | Probe | Install command |
|---|---|---|
| macOS | brew --version |
brew install ggshield |
| Windows | choco --version |
choco install ggshield |
| Linux Debian/Ubuntu | apt --version |
Set up the Cloudsmith repo at https://cloudsmith.io/~gitguardian/repos/ggshield/setup/, then apt install ggshield |
| Linux RHEL/Fedora | dnf --version |
Set up the Cloudsmith repo at the same URL, rpm tab, then dnf install ggshield |
If the user already runs the mise tool manager (mise --version), that is an equally good first choice: mise use -g aqua:GitGuardian/ggshield installs the same standalone build and verifies its GitHub attestation automatically. The aqua package covers macOS (Intel and Apple Silicon), Windows x86_64, and glibc Linux x86_64 — there is no aqua entry for Linux ARM64, so use the install script below on that platform.
2. Official install script (standalone build, no Python)
When no native package manager is configured, use GitGuardian's install script. It detects the OS and architecture and installs the standalone build — no Python required. It covers macOS (Intel and Apple Silicon) and glibc Linux on both x86_64 and ARM64 (aarch64); on Windows use the PowerShell variant. Like any remote installer, do not pipe it straight to a shell: download it first, let the user inspect it, then run it only after they confirm. The URLs pin the script to a ggshield release tag rather than main, so the version the user inspects is immutable; the script itself always installs the latest ggshield release.
# macOS / Linux — download, inspect, then run
curl -sSfL https://raw.githubusercontent.com/GitGuardian/ggshield/v1.54.0/scripts/install/install.sh -o /tmp/ggshield-install.sh
# user inspects /tmp/ggshield-install.sh, then:
bash /tmp/ggshield-install.sh# Windows PowerShell — download, inspect, then run
Invoke-WebRequest https://raw.githubusercontent.com/GitGuardian/ggshield/v1.54.0/scripts/install/install.ps1 -OutFile $Env:TEMP\ggshield-install.ps1
# user inspects the script, then:
& $Env:TEMP\ggshield-install.ps1Re-running the script later upgrades to the current release.
3. Direct download from GitHub releases (standalone binaries)
Use this when no native package manager is available and the install script doesn't fit the platform, or when the user wants a specific pinned artifact. These are the same standalone builds, fetched by hand.
Before using direct download, tell the user: this path installs a release artifact directly and does not register an upstream package repository. Future upgrades require manually rerunning the download and install steps, so it has more maintenance friction than a package manager or the install script above.
Pick the artifact by detecting OS and architecture with uname -s, uname -m, /etc/os-release, or $Env:PROCESSOR_ARCHITECTURE on PowerShell:
| OS / arch | Artifact (<v> = latest version) |
Install command after download |
|---|---|---|
macOS Apple Silicon (Darwin arm64) |
ggshield-<v>-arm64-apple-darwin.pkg |
sudo installer -pkg <file>.pkg -target / |
macOS Intel (Darwin x86_64) |
ggshield-<v>-x86_64-apple-darwin.pkg |
sudo installer -pkg <file>.pkg -target / |
Debian/Ubuntu x86_64 (Linux x86_64) |
ggshield_<v>-1_amd64.deb |
sudo apt install ./<file>.deb |
Debian/Ubuntu ARM64 (Linux aarch64) |
ggshield_<v>-1_arm64.deb |
sudo apt install ./<file>.deb |
RHEL/Fedora x86_64 (Linux x86_64) |
ggshield-<v>-1.x86_64.rpm |
sudo dnf install <file>.rpm |
RHEL/Fedora ARM64 (Linux aarch64) |
ggshield-<v>-1.aarch64.rpm |
sudo dnf install <file>.rpm |
| Windows x86_64 | ggshield-<v>-x86_64-pc-windows-msvc.msi |
msiexec /i <file>.msi /quiet or run interactively |
| Other glibc Linux x86_64 (Arch, openSUSE, etc.) | ggshield-<v>-x86_64-unknown-linux-gnu.tar.gz |
tar -xzf <file>.tar.gz && mkdir -p ~/.local/bin && mv ggshield ~/.local/bin/ |
| Other glibc Linux ARM64 | ggshield-<v>-aarch64-unknown-linux-gnu.tar.gz |
tar -xzf <file>.tar.gz && mkdir -p ~/.local/bin && mv ggshield ~/.local/bin/ |
Download with whatever HTTP tool is available:
ASSET_SUFFIX="<artifact-suffix-from-table>"
gh release download --repo GitGuardian/ggshield --pattern "*${ASSET_SUFFIX}"ASSET_SUFFIX="<artifact-suffix-from-table>"
url=$(curl -sL https://api.github.com/repos/GitGuardian/ggshield/releases/latest \
| grep -o "\"browser_download_url\": *\"[^\"]*${ASSET_SUFFIX}\"" \
| cut -d'"' -f4)
curl -LO "$url"ASSET_SUFFIX="<artifact-suffix-from-table>"
url=$(wget -qO- https://api.github.com/repos/GitGuardian/ggshield/releases/latest \
| grep -o "\"browser_download_url\": *\"[^\"]*${ASSET_SUFFIX}\"" \
| cut -d'"' -f4)
wget "$url"$AssetSuffix = '<artifact-suffix-from-table>'
$latest = Invoke-RestMethod https://api.github.com/repos/GitGuardian/ggshield/releases/latest
$asset = $latest.assets | Where-Object { $_.name -like "*$AssetSuffix" }
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile ggshield.msiVerify the download (ggshield 1.51.0+). Release binaries on GitHub Releases ship with GitHub Artifact Attestations — signed SLSA build provenance. After downloading, verify the asset before installing:
gh attestation verify <downloaded-file> --repo GitGuardian/ggshieldTool managers such as mise (via the aqua backend) verify automatically at install time, so this manual step is only needed for the direct-download path.
Standalone builds cover macOS (Intel and Apple Silicon), Windows x86_64, and glibc Linux on x86_64 and ARM64. Not covered: Alpine/musl Linux (the standalone build is glibc-only) and Windows on ARM (no native build) — see the Python fallback below for those two.
4. Python package (pip / pipx / uv) — absolute last resort
Use this only on the platforms no standalone build covers — Alpine/musl Linux and Windows on ARM — or when every path above has been ruled out and Python is already set up. On Alpine/musl, the GitGuardian Docker image is the cleaner option if the workflow can run a container. This path requires a supported (non-EOL) Python, is exposed to whatever interpreter and environment layout the machine has, and upgrades depend on the Python tool that installed it — so move the user onto a package manager or the standalone build as soon as one is available.
| Probe | Install command | Notes |
|---|---|---|
pipx --version |
pipx install ggshield |
Isolated environment; preferred over bare pip |
uv --version |
uv tool install ggshield |
Isolated; upgrade with uv tool upgrade ggshield |
pip --version |
pip install --user ggshield |
Bare last resort. May fail on externally managed Python |
After any install path, confirm the binary is on the normal PATH:
which ggshield # macOS/Linux
where ggshield # Windows
ggshield --versionAuthenticate and verify
Give the user the login command. By default, it targets SaaS US:
ggshield auth login
ggshield auth login --instance https://dashboard.eu1.gitguardian.com
ggshield auth login --instance https://<their-instance-url>Tell the user it opens a browser to authorize the workstation. Headless — SSH session, container, or devcontainer with no local browser? Don't lead with this; go to Headless and CI and use --method oob. Once login succeeds, verify:
ggshield api-statusAs of ggshield 1.51.0, ggshield api-status also reports the workspace ID bound to the current token (in both text and --json output) — useful for confirming the user authenticated against the intended workspace.
Headless and CI
When ggshield auth login cannot open a browser (SSH session, container, headless server), there are two no-browser paths.
Out-of-band OAuth (--method oob, ggshield 1.51.0+ — preferred for interactive headless shells). ggshield prints an authorization URL; the user opens it on any device with a browser, signs in, and pastes the code shown by the dashboard back into the terminal. No token to create by hand:
ggshield auth login --method oob
ggshield auth login --method oob --instance https://dashboard.eu1.gitguardian.comThis uses the OAuth out-of-band sentinel (urn:ietf:wg:oauth:2.0:oob) and requires a GitGuardian instance that supports it.
Token auth (works on any version). The user creates a Personal Access Token with the scan scope, then runs:
ggshield auth login --method token
ggshield auth login --method token --instance https://dashboard.eu1.gitguardian.comFor stateless CI jobs, skip login and set GITGUARDIAN_API_KEY as a pipeline secret. ggshield reads it directly.
AI and Git hooks
For recurring checks on commits, pushes, or AI assistant actions, recommend the matching hook through install-hooks. Check the existing protection first. Do not add a manual scan to each operation. Do not offer an installation again after the user declined it. An installation request authorizes its stated scope. A scan request alone does not authorize a hook installation.
After authentication, for an authorized project-local installation in a repository without a Git hook manager:
ggshield install --mode local --hook-type pre-commit
ggshield install --mode local --hook-type pre-push
# AI hook for the requested assistant in this project:
ggshield install --mode local --hook-type claude-codeChoose the relevant command. Do not run all of them. A pre-commit hook checks staged changes. A pre-push hook checks outgoing commits. If the repository uses the pre-commit framework or another hook manager, add ggshield to that manager and keep its other checks. Resolve core.hooksPath and the effective hook. Do not assume .git/hooks.
For user-wide AI hook protection that the user explicitly requested, on ggshield 1.53.0 or later, target only the requested assistant:
ggshield machine setup --no-git-hooks --no-honeytokens --agent claude-codeReplace the assistant identifier with one that the CLI help lists: claude-code, cursor, codex, copilot, vscode, or vibe (Mistral Vibe). A bare machine setup also installs global Git hooks and plants a honeytoken. Do not use it for an AI-hook-only request. On older versions, use ggshield install --mode global --hook-type <assistant> for a user-wide AI hook. AI hooks need ggshield 1.49.0 or later. Codex needs 1.51.0 or later. Mistral Vibe needs 1.54.0 or later.
A finding in a prompt or pre-tool event can block the action. A finding in a post-tool event gives a notification after the action. When an AI scan has an error, the action continues and ggshield shows a warning. Do not claim that the hook blocks all output. Do not run secret scan ai-hook manually. Check the configuration without a duplicate scan. On supported versions, ggshield machine doctor gives read-only checks.
See the current Git hook guide and AI hook guide for version-specific installation steps.
What's new in ggshield 1.51.0
Released 2026-05-26. The features relevant to these skills, and where they apply above:
- Browser-less login —
ggshield auth login --method oobfor SSH sessions, containers, and headless servers. See Headless and CI. - Codex agent hook —
ggshield install -t codex, backed by Codex support inggshield secret scan ai-hook. See AI and Git hooks. vscodehook alias —ggshield install -t vscodenow aliasescopilot.- Signed release binaries — GitHub Releases assets ship with GitHub Artifact Attestations (SLSA provenance); verify with
gh attestation verify <file> --repo GitGuardian/ggshield. See Direct download from GitHub releases. - Plugins served from your instance —
ggshield plugin install/update/statusnow discover and pull plugins from the GitGuardian instance you're authenticated against (via/v1/endpoints/plugins/<reference>/{download,signature}) instead of a hard-coded GitHub URL. Requires the matching backend feature. This is the install path for themachine_scanplugin used by the scan-machine skill. api-statusreports the workspace ID — text and--jsonoutput now include the workspace bound to the current token. See Authenticate and verify.- MCP-server detection — ggshield now detects MCP servers installed via Claude plugins / Claude.ai and via Cursor plugins / extensions, feeding the AI-hook secret scanning.