Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Git

git is not a network tool, but fetches and pushes fail for network reasons all the time: SSH key problems, TLS interception by corporate proxies, blocked ports. Git has built-in knobs that expose what its transport (SSH or HTTPS) is actually doing.

If you use Git accounts in several organizations from one machine, see Git and SSH.

Availability

PlatformHow to get it
Windows (Cygwin)install the git package
Windows (native)Git for Windows
Fedorasudo dnf install git
Ubuntu / Debiansudo apt install git

Debugging SSH

Make git’s underlying ssh invocation verbose. The output shows which key is offered, which host key is received, and where authentication fails:

GIT_SSH_COMMAND="ssh -vvv" git clone <REPO_SSH_URL>

Test SSH authentication to the host directly, without git:

ssh -T git@github.com

Debugging HTTPS

Show the full HTTP conversation including TLS handshake and proxy usage:

GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone <REPO_HTTPS_URL>

Point git at a corporate CA bundle when a TLS-intercepting proxy breaks certificate verification (prefer this over disabling verification):

git config --global http.sslCAInfo /path/to/corporate-ca-bundle.pem

Further Reading