Git Reference ยท Environment Variables
GIT_CURL_VERBOSE
Reference for GIT_CURL_VERBOSE and GIT_TRACE_CURL: print the HTTP requests, headers and TLS details behind git clone, fetch and push over https.
Git talks to http:// and https:// remotes through libcurl, in a helper program called git-remote-http (and git-remote-https). When a clone fails with "unable to access", "SSL certificate problem" or a stalled transfer, the one-line error hides what happened. GIT_CURL_VERBOSE=1 asks libcurl to print its own diagnostic output: the DNS lookup, the TLS handshake, every request and response header.
GIT_TRACE_CURL does the same job through Git's trace facility, which means it can go to a file, includes a timestamp for each line, and can show the request and response bodies as hex and text. It is the more modern choice, and what Git developers usually ask for in bug reports.
GIT_CURL_VERBOSE=1 git ls-remote https://git.example.com/team/repo.git GIT_TRACE_CURL=1 GIT_TRACE_CURL_NO_DATA=1 git fetch
Try it
The Git on this site's runner is built without HTTP support and has no network, so these examples show what is not affected and what a failure looks like. The read-only block after them shows the shape of a real trace.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
== Info: Trying 192.0.2.10:443... == Info: Connected to git.example.com (192.0.2.10) port 443 == Info: TLSv1.3 handshake, server certificate verified => Send header: GET /team/repo.git/info/refs?service=git-upload-pack HTTP/1.1 => Send header: Host: git.example.com => Send header: Git-Protocol: version=2 <= Recv header: HTTP/1.1 200 OK <= Recv header: Content-Type: application/x-git-upload-pack-advertisement
This is illustrative, with documentation addresses; real output has more lines and timestamps.
Syntax
GIT_CURL_VERBOSE=1 git <command> GIT_TRACE_CURL=<1|path> git <command> GIT_TRACE_CURL_NO_DATA=1 GIT_TRACE_CURL=1 git <command>
| Name | Description |
|---|---|
GIT_CURL_VERBOSE |
libcurl's verbose output on standard error. Any non-empty value turns it on. |
GIT_TRACE_CURL |
Trace-style output with => Send and <= Recv lines, including bodies. Accepts a file path like other trace variables. |
GIT_TRACE_CURL_NO_DATA |
When set, bodies (pack data, pkt-lines) are left out; only headers and info remain. |
Edge cases: neither variable has any effect on ssh://, git:// or file:// remotes. For ssh problems use GIT_SSH_COMMAND="ssh -vvv".
Usage notes
- Secrets: both outputs include the
Authorizationheader (basic credentials are only base64). Never paste a raw trace into an issue; replace the header value first. Recent Git versions redact some authentication headers by default;GIT_TRACE_REDACT=0turns that off, so leave it alone unless you really need the raw values. - Typical diagnoses: a
407means a proxy wants credentials (http.proxy);401after a successful TLS handshake is a credential problem; "SSL certificate problem" points tohttp.sslCAInfoor a corporate TLS-inspecting proxy. - Redirects show up as
301or302responses followed by a second request. Git follows redirects for the initialinfo/refsrequest only (http.followRedirects). - Smart versus dumb HTTP: a request for
info/refs?service=git-upload-packwith aContent-Typeofapplication/x-git-upload-pack-advertisementmeans the server speaks the smart protocol. - Speed problems:
http.lowSpeedLimitandhttp.lowSpeedTimeabort stalled transfers;http.postBuffermatters for large pushes through proxies that limit request sizes. - Combine with
GIT_TRACE_PACKETto see the Git protocol on top of the HTTP exchange.