Use case

Catch issues before they're pushed

Run the gate locally as a pre-push hook for instant feedback

Install GateTest as a git pre-push hook so secrets, syntax errors, and obvious vulnerabilities are caught on your machine — before they ever reach the shared history where a leaked credential is already compromised.

The problem

Some problems are far cheaper to catch before the push than after. A secret that lands in shared git history is compromised permanently, even if you delete it in the next commit — the value still sits in history, on every clone and fork.

A local pre-push hook moves that catch left to the last safe moment: your machine, before anything leaves it.

How GateTest does it

GateTest ships a pre-push hook that runs a fast suite before `git push` completes. Catch a secret or a syntax error and the push is stopped with the finding shown inline.

Local hooks can be advisory (surface findings without blocking developer flow) while the CI gate stays authoritative — the hook is for speed, CI is for enforcement.

install the pre-push hook
# from your repo root
npx @gatetest/cli install-hook pre-push

# now every 'git push' runs a fast scan first;
# a leaked secret or syntax error stops the push.

Steps

  1. 1Install the GateTest pre-push hook in your repo.
  2. 2Push as normal — the hook runs a fast suite first.
  3. 3Findings appear inline; fix and re-push.
  4. 4Keep the CI gate as the authoritative enforcement layer.

Frequently asked questions

Should the pre-push hook block the push?

It can, but many teams run it advisory — surfacing findings without blocking flow — and rely on the CI gate as the hard enforcement layer. The hook is about fast local feedback; CI is the gate of record.

Why catch secrets before the push specifically?

Because once a secret is in shared git history it's compromised even if you delete it later — it persists in earlier commits and every clone. Catching it pre-push is the difference between 'don't commit that' and rotating a live credential.

Put this gate on your repo

Free preview of findings. Pay per scan — no subscription. AI auto-fix PR on the Scan + Fix tier.

Related use cases