Skip to content

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.log

Trace variables ​

VariableQuick syntaxCatches
GIT_TRACE=1any git commandCall tree — shows built-in and external helper invocations
GIT_TRACE_PACKET=1fetch, push, clone, ls-remoteRaw wire protocol — want/have/ACK/NAK frames
GIT_TRACE_SETUP=1git status, git logGitdir discovery, config file load order
GIT_TRACE_PERFORMANCE=1clone, fetch, status, diffPer-step wall-clock time (read_cache, diff, traverse)
GIT_CURL_VERBOSE=1any https remote opHTTP headers, TLS handshake, DNS, auth status
GIT_TRACE_SHALLOW=1shallow fetch/cloneDepth negotiation, unshallow points
GIT_TRACE_PACK_ACCESS=1rev-list, cat-fileObject-level access (very verbose)

Common CURL patterns ​

CURL outputProbable cause
SSL certificate problemInternal CA missing from container
401 Authorization RequiredNo token, expired token, or no credential helper
Transfer closed with N bytes remainingProxy timeout or interrupted connection
Empty reply from serverServer closed connection mid-response
schannel: next InitializeSecurityContext failedWindows 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).log

Security notes ​

  • Always redirect stderr: 2>&1 or the CI log collector misses traces
  • Redact auth: pipe through grep -vE '(Authorization|access_token|password)' before logging to indexed storage
  • GIT_TRACE_PACK_ACCESS only on targeted investigations: can generate GB-level output on large repos

Git Master — Git Reference for Every Skill Level