Skip to content

Instantly share code, notes, and snippets.

@jasonzhouu
Last active November 12, 2019 05:50
Show Gist options
  • Save jasonzhouu/ce762741e01b771a4b0dc73339671128 to your computer and use it in GitHub Desktop.
Save jasonzhouu/ce762741e01b771a4b0dc73339671128 to your computer and use it in GitHub Desktop.
proxy git clone

git clone from github is always slow in China, using a proxy will be much better. Proxychains is CLI tool that can proxy command in terminal.

such as:

proxychains git clone https://github.com/GoogleChrome/web.dev

before using this command, 2 steps should be made:

  1. sudo apt install proxychains
  2. setting proxy server's url in /etc/proxychains.conf, http are socks proxy are both supported. My configuration is below, in which I'm using socks5 proxy with url of 127.0.0.1, 1080 port.
  3. (optional) set bash alias, alias gc="proxychains git clone"

The details about configuration can refer to: https://www.binarytides.com/proxify-applications-with-tsocks-and-proxychains-on-ubuntu/

it can also used in npm install, setting bash alias:

alias npm="proxychains npm"
# proxychains.conf VER 3.1
#
# HTTP, SOCKS4, SOCKS5 tunneling proxifier with DNS.
#
# The option below identifies how the ProxyList is treated.
# only one option should be uncommented at time,
# otherwise the last appearing option will be accepted
#
#dynamic_chain
#
# Dynamic - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# at least one proxy must be online to play in chain
# (dead proxies are skipped)
# otherwise EINTR is returned to the app
#
strict_chain
#
# Strict - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# all proxies must be online to play in chain
# otherwise EINTR is returned to the app
#
#random_chain
#
# Random - Each connection will be done via random proxy
# (or proxy chain, see chain_len) from the list.
# this option is good to test your IDS :)
# Make sense only if random_chain
#chain_len = 2
# Quiet mode (no output from library)
#quiet_mode
# Proxy DNS requests - no leak for DNS data
#proxy_dns
# Some timeouts in milliseconds
tcp_read_time_out 15000
tcp_connect_time_out 8000
# ProxyList format
# type host port [user pass]
# (values separated by 'tab' or 'blank')
#
#
# Examples:
#
# socks5 192.168.67.78 1080 lamer secret
# http 192.168.89.3 8080 justu hidden
# socks4 192.168.1.49 1080
# http 192.168.39.93 8080
#
#
# proxy types: http, socks4, socks5
# ( auth types supported: "basic"-http "user/pass"-socks )
#
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
socks5 127.0.0.1 1080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment