curl proxy setup
Use an HTTP or SOCKS5 proxy with curl: -x, credentials, socks5h, environment variables, .curlrc and an exit check.
How to make Git go through a proxy: one command for HTTPS remotes, a different proxy for a single host, SOCKS5, how to switch it off again, SSH remotes, and how to check that it works.
A proxy changes only the network path between your computer and the Git server. It does not change the rules of the Git hosting service you use, who may use it or where. Git itself works with any ordinary HTTP or SOCKS5 proxy that only forwards traffic.
A remote is the address Git talks to. Run git remote -v to see yours. If it starts with https:// (or http://), Git talks through the curl library and the http.proxy setting applies. If it starts with git@ or ssh://, Git hands the connection to ssh and http.proxy is ignored; that case is in the SSH section below. If you are not sure which you have, the simplest way to use a proxy is to switch the remote to its https:// address.
The git-config page describes http.proxy as an override of the proxy that is normally set with the http_proxy, https_proxy and all_proxy environment variables. It is the only key you need, and it covers https:// addresses too. The value is [protocol://][user[:password]@]proxyhost[:port]. The second command in the example prints the value back, which is the quickest way to see what is set.
git config --global http.proxy http://USERNAME:PASSWORD@HOST:PORT
git config --global --get http.proxyReplace HOST, PORT, USERNAME and PASSWORD with the values from My assets.
If the username or password contains special characters, percent-encode them in the address: @ becomes %40, : becomes %3A, / becomes %2F, # becomes %23 and % becomes %25. Copying the values from My assets is safer than typing them. The git-config page also allows a user name without a password, for example http://USERNAME@HOST:PORT: Git then asks for the password the way it does for other credentials, so the password is not stored in the file. Note that git config --global writes to ~/.gitconfig as plain text, so a password inside the address can be read by anyone who can read that file.
Any http.* option can be applied to some URLs only, by putting the URL in the key: http.<url>.proxy. The scheme and the host must match the remote exactly, and a longer match wins. This is handy when only GitHub needs the proxy and your company's own Git server must be reached directly. Giving remote.<name>.proxy an empty string disables the proxy for that one remote, which the git-config page states; it does not say what an empty http.<url>.proxy does, so use the remote.<name>.proxy form when you need to switch the proxy off for a single remote.
git config --global http.https://github.com/.proxy http://USERNAME:PASSWORD@HOST:PORT
git config remote.origin.proxy ""The first line sets the proxy for github.com only. The second line turns it off for the remote named origin in the current repository.
To try a proxy without saving anything, pass the setting for a single run with git -c. Nothing is written to ~/.gitconfig, and the password stays out of the config file (it is still visible in the command line while the command runs).
git -c http.proxy=http://USERNAME:PASSWORD@HOST:PORT clone https://github.com/git/git.gitReplace HOST, PORT, USERNAME and PASSWORD with the values from My assets.
Git hands the proxy string to curl, and the Git documentation points to the syntax curl understands. The curl documentation lists socks5:// and socks5h://; with socks5h:// the proxy, not your computer, resolves the website name. Use socks5h:// unless you have a reason to resolve names locally. The Git page does not list the schemes itself, so confirm it works with the check below on your Git version.
git config --global http.proxy socks5h://USERNAME:PASSWORD@HOST:PORTReplace HOST, PORT, USERNAME and PASSWORD with the values from My assets.
Remove the key with --unset. If you set the same key in several places, use --unset-all, and run git config --global --list to confirm that no http.proxy line is left. The proxy environment variables http_proxy, https_proxy and all_proxy are also read, as the git-config page says, so unset those in the shell too if the proxy keeps coming back.
git config --global --unset http.proxy
git config --global --unset-all http.https://github.com/.proxyRun git config --global --list afterwards to see what is left.
http.proxy does nothing for SSH remotes, because Git runs ssh and ssh makes the connection. In ssh you set a ProxyCommand: a command that opens the connection to the server for ssh, with %h standing for the remote host and %p for the remote port, as the ssh_config manual explains. The manual's own example uses nc with -X connect for an HTTP proxy. ProxyJump is not a replacement: it is described only for jumping through another SSH host, not through a SOCKS or HTTP proxy.
For a proxy with a username and password you need a tool that can send them. The OpenBSD nc manual says proxy authentication is only supported for HTTP CONNECT proxies and describes a user name option but no password option, so it does not fit a SOCKS5 proxy with a login. The Ncat tool from the Nmap project has --proxy-type socks5 and --proxy-auth USERNAME:PASSWORD for exactly this. Install Ncat first (it comes with Nmap). The example below is the ssh_config form; the second command passes the same ProxyCommand for one run through GIT_SSH_COMMAND, which the Git documentation says is run by the shell.
The Ncat page does not show it inside a ProxyCommand, so test it with the check below. Also remember that some proxies only allow web ports and refuse a connection to port 22; if the connection closes at once, switch the remote to https:// instead.
# ~/.ssh/config
Host github.com
ProxyCommand ncat --proxy HOST:PORT --proxy-type socks5 --proxy-auth USERNAME:PASSWORD %h %pReplace HOST, PORT, USERNAME and PASSWORD with the values from My assets.
GIT_SSH_COMMAND='ssh -o "ProxyCommand=ncat --proxy HOST:PORT --proxy-type socks5 --proxy-auth USERNAME:PASSWORD %h %p"' git ls-remote [email protected]:git/git.git HEADReplace HOST, PORT, USERNAME and PASSWORD with the values from My assets.
Run git config --show-origin --get-all http.proxy. It shows the value and the file it comes from, so you can find a forgotten setting.
git ls-remote asks the server for its list of branches and downloads no files. With GIT_TRACE_CURL=1 the first lines show which host and port Git connects to: it should be your proxy, not the Git server.
The second command in the example below shows the IP, country and network that websites see through the same proxy. The guide on how to check your proxy's IP, country and ISP explains the fields.
Clone a small repository you can read, with the proxy set. If it works and the trace points to the proxy host, you are done.
GIT_TRACE_CURL=1 git ls-remote https://github.com/git/git.git HEAD
curl -x http://USERNAME:PASSWORD@HOST:PORT https://ipinfo.io/jsonReplace HOST, PORT, USERNAME and PASSWORD with the values from My assets.
• Proxy CONNECT aborted, or 407 Proxy Authentication Required. The proxy rejected the username or password. Copy them again and check the percent-encoding.
• Could not resolve proxy, or Failed to connect. Wrong HOST or PORT, or the lease has ended. Test the same address with the curl command above.
• The proxy works for curl but Git hangs. Check git config --show-origin --get-all http.proxy for a leftover value.
• Cloning over ssh ignores the proxy. This is expected: set ProxyCommand as shown, or use the https:// address.
• Connection closed at once over ssh. The proxy may not allow port 22; use an https:// remote.
Every command here needs only the host, port, username and password of a Proxy302 proxy. Rotating residential traffic is billed per GB and the exit country is set when you generate the proxy; HTTP is on port 2222 and SOCKS5 on port 3333 of proxy.proxy302.com. A static ISP IP stays fixed for the whole lease and does not rotate, which suits a tool that you want to always leave from the same address. HTTP or SOCKS5 is chosen when you buy, and one IP carries one protocol.
Open the rotating residential page, choose the line, keep Protocol on HTTP (or choose SOCKS5), then click Review cost and generate.
Open My assets (the console page that holds everything you bought) and copy HOST, PORT, USERNAME and PASSWORD. The Connect page shows a ready example with your own endpoint.
Put the values into the commands above.
Confirm the exit with https://ipinfo.io/json through the proxy.
From mainland China, start the helper tool from the Connect page first and keep it open while you use the proxy.
The Budget line costs US$1.50 per GB, US$1.35 per GB in a 100 GB package and US$1.20 per GB at 300 GB. A static ISP IP costs US$0.50 for one day and US$7.99 for 30 days. There is no free trial, and the smallest purchase is 1 GB or one IP for one day. Which exit locations are available changes daily.
The git-config page documents http.proxy as the override for the proxy normally set by http_proxy, https_proxy and all_proxy, and it is the key to use for https:// remotes as well.
SSH remotes are handled by ssh, not by curl. Set a ProxyCommand in ~/.ssh/config, or change the remote to https://.
HTTP is the simpler choice for https:// remotes. Choose SOCKS5 with socks5h:// if that is what you bought, or if you need ssh through ProxyCommand with a login.
Run the git config command without --global inside that repository: it writes the setting to the repository's own .git/config instead of ~/.gitconfig.
Official documentation · Confirmed on:
Read on 2 November 2026: http.proxy overrides the proxy normally set by the http_proxy, https_proxy and all_proxy variables; it accepts the syntax curl understands plus a user name without a password (Git then asks for the password the way it does for other credentials); the stated syntax is [protocol://][user[:password]@]proxyhost[:port][/path]; remote.<name>.proxy overrides it per remote and an empty string disables proxying for that remote; http.<url>.* options apply to matching URLs, the scheme and host must match.
The page does not list the proxy schemes (socks5, socks5h) and does not say what an empty http.proxy does. The socks5h scheme comes from the curl documentation below: test it.
Official documentation · Confirmed on:
Read on 2 November 2026: GIT_TRACE_CURL enables a curl full trace dump of the transport, similar to curl --trace-ascii; GIT_SSH_COMMAND is used instead of ssh for fetch and push, takes precedence over GIT_SSH and is interpreted by the shell.
The first part of the page (about 100,000 characters) was read; GIT_CURL_VERBOSE was not found there, so this guide uses GIT_TRACE_CURL.
Official documentation · Confirmed on:
Read on 2 November 2026: socks5:// is a SOCKS5 proxy; socks5h:// is a SOCKS5 proxy where the proxy resolves the URL hostname; an empty string explicitly disables the proxy even if an environment variable is set; all_proxy is used if no protocol-specific proxy was set.
Git passes the proxy string to curl; the Git documentation itself only points to curl's syntax.
Official documentation · Confirmed on:
Read on 2 November 2026: ProxyCommand specifies the command used to connect to the server and accepts the tokens %h (remote host), %p (remote port), %r and %n; the manual's example is ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p; ProxyJump takes one or more [user@]host[:port] jump hosts and makes an ssh connection through them.
ProxyJump is described only for ssh hops; the page does not say it can use a SOCKS or HTTP proxy.
Official documentation · Confirmed on:
Read on 2 November 2026: -X selects the proxy protocol (4, 4A, 5, connect), -x gives the proxy address and port, -P gives a proxy user name, and the manual states that proxy authentication is only supported for HTTP CONNECT proxies at present; no password option is described.
Other nc builds can differ; this describes the OpenBSD one.
Official documentation · Confirmed on:
Read on 2 November 2026: ncat --proxy <host>[:<port>] --proxy-type {http|socks4|socks5} <host> [<port>], and --proxy-auth <username>:<password> for HTTP and SOCKS5 proxies.
The page does not show Ncat inside an SSH ProxyCommand; that use follows from the ssh_config manual and is untested here.
Product observation · Confirmed on:
Product facts file of the site (values checked against the console, the backend and the price table on 18-19 October 2026): products, prices in US$ (1 PTC = US$1), lease terms, protocols and ports, countries, quantity limits, no free trial.
Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.