Getting Git to work with a proxy server - fails with Request timed out
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
Git timeout errors behind a proxy usually come from mismatched proxy settings, authentication gaps, or TLS inspection rules. The message "Request timed out" is generic, so a structured diagnosis is important. This guide gives a repeatable workflow for HTTP and HTTPS Git traffic in restricted networks.
Confirm the Network Path First
Before changing Git config, validate that outbound access actually requires proxy and which protocol is allowed.
Quick checks:
If direct curl fails but browser access works through enterprise proxy, Git likely needs explicit proxy configuration.
Also verify remote URL type:
https://...remotes use HTTP proxy settings.git@...remotes use SSH and are affected by different proxy rules.
Configure Proxy in Git
Set proxy for HTTP and HTTPS in Git config.
If proxy requires credentials:
For security, avoid plain-text password in shared machines. Prefer credential manager or environment-based injection handled by secure tooling.
Check applied values:
Unset if wrong:
Use Environment Variables for Session-Scoped Testing
Sometimes global config is not desirable. Use shell variables for temporary sessions.
This helps compare behavior quickly without persistent config changes.
On Windows Git Bash, use the same export syntax in the current shell session.
Diagnose TLS Inspection and Certificates
Corporate proxies may terminate TLS and re-sign certificates. If proxy CA is not trusted by Git TLS backend, requests can timeout or fail with certificate errors.
Safer fix is adding corporate CA bundle, not disabling verification.
Avoid this except emergency debugging:
Disabling verification creates security risk and should not be left enabled.
Timeout and Slow Link Tuning
Timeout symptoms can also be bandwidth or packet inspection latency.
Useful knobs:
This example says transfer below threshold for one minute is considered failure. Tune for your network profile.
You can also test protocol verbosity:
Verbose logs reveal whether timeout happens before proxy handshake, during TLS, or while transferring objects.
Proxy with SSH Remotes
If remote uses SSH, HTTP proxy settings will not help. Options include:
- Switch remote URL to HTTPS.
- Use SSH proxy command if company allows SSH via proxy tunnel.
Example SSH config snippet:
Exact corporate policy varies, so coordinate with network team.
Practical Recovery Workflow
When troubleshooting incident quickly:
- Verify remote protocol and proxy requirement.
- Test with temporary environment proxy variables.
- Apply Git global proxy once verified.
- Validate with
git ls-remotebefore normal pull or push. - Capture trace logs if failure persists and share with IT.
This sequence avoids random configuration churn and shortens resolution time.
Common Pitfalls
- Setting only
http.proxyand forgettinghttps.proxy. Fix by configuring both when using HTTPS remotes. - Leaving stale proxy values after moving networks. Fix by unsetting and rechecking config.
- Embedding credentials in plain text config files. Fix by using secure credential management practices.
- Disabling TLS verification permanently. Fix by installing trusted corporate CA certificate instead.
- Troubleshooting HTTPS settings while remote is SSH. Fix by validating remote URL scheme first.
Summary
- Git timeout behind proxy is usually configuration or certificate path mismatch.
- Diagnose protocol and network path before tuning random settings.
- Configure proxy with either Git config or session environment variables.
- Use trace logging to locate exact failure stage.
- Prefer secure certificate-based fixes over disabling TLS verification.
Related reading
- Getting Git to work with a proxy server - fails with Request timed out
- Getting Http Status code number 200, 301, 404, etc. from HttpWebRequest and HttpWebResponse
- Getting json body in aws Lambda via API gateway
- getting message forbidden reply from AWS API gateway
- Getting the difference between two repositories
- git-checkout older revision of a file under a new name
- Getting GroupNotEmptyException when trying to delete a consumer group in Kafka
- Getting Illegal initial character in schema parsing

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.