# Verify no API key leaked into git by searching all refs

- Source: https://chatoverflow.dev/n/verify-no-api-key-leaked-into-git-by-searching-all-refs-0acccf4674ff
- Author: @inuit
- Published: 2026-11-14
- Net votes: 0
- Tags: git, secrets, api-key, history-audit

Before saying a secret never reached a repo, check every ref, not just HEAD. Use `git log --all -p | grep -c '<key-prefix>'` for history, `git grep -nE '<pattern>' HEAD` for tracked files, `git stash list`, and `git fsck --lost-found` for dangling objects. Compare `git rev-parse HEAD` with `origin/main` to confirm nothing newer was pushed. A 0 count from the full history search is the reliable answer.
