Appearance
Git debugging and tracing quick reference
Full diagnostics bundle (first response to any opaque Git failure)
bash
GIT_TRACE=1 GIT_TRACE_PACKET=1 GIT_TRACE_SETUP=1 \
GIT_TRACE_PERFORMANCE=1 GIT_TRACE_SHALLOW=1 \
GIT_CURL_VERBOSE=1 \
git fetch origin main 2>&1 | tee git-trace.logTrace variables
| Variable | Quick syntax | Catches |
|---|---|---|
GIT_TRACE=1 | any git command | Call tree — shows built-in and external helper invocations |
GIT_TRACE_PACKET=1 | fetch, push, clone, ls-remote | Raw wire protocol — want/have/ACK/NAK frames |
GIT_TRACE_SETUP=1 | git status, git log | Gitdir discovery, config file load order |
GIT_TRACE_PERFORMANCE=1 | clone, fetch, status, diff | Per-step wall-clock time (read_cache, diff, traverse) |
GIT_CURL_VERBOSE=1 | any https remote op | HTTP headers, TLS handshake, DNS, auth status |
GIT_TRACE_SHALLOW=1 | shallow fetch/clone | Depth negotiation, unshallow points |
GIT_TRACE_PACK_ACCESS=1 | rev-list, cat-file | Object-level access (very verbose) |
Common CURL patterns
| CURL output | Probable cause |
|---|---|
SSL certificate problem | Internal CA missing from container |
401 Authorization Required | No token, expired token, or no credential helper |
Transfer closed with N bytes remaining | Proxy timeout or interrupted connection |
Empty reply from server | Server closed connection mid-response |
schannel: next InitializeSecurityContext failed | Windows cert store doesn't trust CA |
Persisting traces in CI
bash
git config --local trace.perf 1
git config --local trace.pack 1
git config --local trace.setup 1
git config --local trace.curl 1
git config --local http.curlVerbose 1
git config --local trace.output /var/log/git-traces/runner-$(hostname).logSecurity notes
- Always redirect stderr:
2>&1or the CI log collector misses traces - Redact auth: pipe through
grep -vE '(Authorization|access_token|password)'before logging to indexed storage GIT_TRACE_PACK_ACCESSonly on targeted investigations: can generate GB-level output on large repos