Git – Verbose Mode: Debug Fatal Errors

Sometimes it may be complex to debug Git errors, like “fatal: repository not found” or “fatal: authentication failed” with the default level of verbosity in Git.

To debug different network, security, performance and many other issues in Git it is very helpful to know how to increase verbosity.

In this note i am showing how to debug Git issues from the command line by increasing verbosity of Git commands in Linux, MacOS and Windows.

Cool Tip: Enable DEBUG mode and increase VERBOSITY in Ansible! Read more →

Git Verbose Mode in Linux/MacOS

Debug Git command:

$ GIT_TRACE=true \
GIT_CURL_VERBOSE=true \
GIT_SSH_COMMAND="ssh -vvv" \
git clone git://host.xz/path/to/repo.git

Debug Git-related issues with the maximum level of verbosity:

$ GIT_TRACE=true \
GIT_CURL_VERBOSE=true \
GIT_SSH_COMMAND="ssh -vvv" \
GIT_TRACE_PACK_ACCESS=true \
GIT_TRACE_PACKET=true \
GIT_TRACE_PACKFILE=true \
GIT_TRACE_PERFORMANCE=true \
GIT_TRACE_SETUP=true \
GIT_TRACE_SHALLOW=true \
git clone git://host.xz/path/to/repo.git

Git Verbose Mode in Windows

Debug Git command:

C:\> set GIT_TRACE=true
C:\> set GIT_CURL_VERBOSE=true
C:\> set GIT_SSH_COMMAND=ssh -vvv
C:\> git clone git://host.xz/path/to/repo.git

Debug Git-related issues with the maximum level of verbosity:

C:\> set GIT_TRACE=true
C:\> set GIT_CURL_VERBOSE=true
C:\> set GIT_SSH_COMMAND=ssh -vvv
C:\> set GIT_TRACE_PACK_ACCESS=true
C:\> set GIT_TRACE_PACKET=true
C:\> set GIT_TRACE_PACKFILE=true
C:\> set GIT_TRACE_PERFORMANCE=true
C:\> set GIT_TRACE_SETUP=true
C:\> set GIT_TRACE_SHALLOW=true
C:\> git clone git://host.xz/path/to/repo.git

To avoid the error below, the variable GIT_SSH_COMMAND=ssh -vvv in Windows CMD must be set without quotes: “fatal: ssh variant ‘simple’ does not support setting port

Git Debug Options

The environment variables that can be used to increase verbosity in Git:

Option Description
GIT_TRACE=true Enable general trace messages
GIT_CURL_VERBOSE=true Print HTTP headers (similar to curl -v)
GIT_SSH_COMMAND="ssh -vvv" Print SSH debug messages (similar to ssh -vvv)
GIT_TRACE_PACK_ACCESS=true Enable trace messages for all accesses to any packs
GIT_TRACE_PACKET=true Enable trace messages for all packets coming in or out of a given program
GIT_TRACE_PACKFILE=true Enable tracing of packfiles sent or received by a given program
GIT_TRACE_PERFORMANCE=true Enable performance related trace messages
GIT_TRACE_SETUP=true Enable trace messages printing the .git, working tree and current working directory after Git has completed its setup phase
GIT_TRACE_SHALLOW=true Enable trace messages that can help debugging fetching/cloning of shallow repositories
Was it useful? Share this post with the world!

One Reply to “Git – Verbose Mode: Debug Fatal Errors”

  1. I don’t understand why you chose grey text on a white background. It has low contrast and makes it hard to read for people with visual disabilities. Worse is the grey text on a grey background. Please consider making your website more accessible and inclusive by changing to black text.

Leave a Reply