Git verbose connection diagnostics
Git can use multiple transport protocols. We focus here on diagnosing connection issues for two commonly used Git transfer protocols: SSH and HTTPS.
Regardless of protocol used, Git trace capability can give more details. For example, before the problem commands, type:
- Windows:
set GIT_TRACE=1
- macOS / Linux:
export GIT_TRACE=1
Git clone over HTTPS can hang for a minute or more.
Git clone from Overleaf will hang while other collaborators are making edits via the Overleaf web browser editor.
Overleaf uses Git over HTTPS, and when Overleaf is busy (say, near federal grant deadlines) Git operations can be significantly slower on Overleaf.
The verbose options of Git don’t add much information for Git over HTTPS connections, just a single additional line is added by --verbose
like:
POST git-upload-pack (150 bytes)
Git over HTTPS can have a timeout:
git config --global http.lowSpeedLimit 1000
git config --global http.lowSpeedTime 60
This means that connections of less than 1 kB / sec for 60 seconds will be dropped. This avoids connection hangs, but could cause marginal connections to fail, so adjust parameters based on your connection and server if needed.
Git over SSH verbosity can be configured on a per-Git-command basis starting with:
git -c core.sshCommand="ssh -v"
This is quite verbose, so we usually wouldn’t add this to the Git config file.
Git over SSH timeouts can be addressed via SSH settings.
reference: GitLab Git troubleshooting connection tips