Configure proxy for git

For http and https protocol:

$ git config --global http.proxy $http_proxy
$ git config --global https.proxy $http_proxy

For git protocol

  • Install socat.
  • Create /usr/bin/gitproxy with content:
    #!/bin/sh
    
    proxy_host=<your_proxy_host>
    proxy_port=<your_proxy_port>
    proxy_user=<your_proxy_username>
    proxy_pass=<your_proxy_password>
    
    exec socat STDIO PROXY:$proxy_host:$1:$2,proxyport=$proxy_port,proxyauth=$proxy_user:$proxy_pass
    
  • Set execute permission: sudo chmod +x /usr/bin/gitproxy
  • Configure git: git config --global core.gitproxy gitproxy
  • Disable SSL verify: git config --global http.sslverify false
git  proxy 

Configure proxy for docker

Create a systemd drop-in directory for the docker service

$ sudo mkdir -p /etc/systemd/system/docker.service.d

Add proxy configuration into /etc/systemd/system/docker.service.d/http-proxy.conf (create if not exist)

[Service]
Environment="HTTP_PROXY=<your_proxy>"
Environment="HTTPS_PROXY=<your_proxy>/"
Environment="NO_PROXY=localhost,127.0.0.1"

Flush change and restart service

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

Configure proxy for ssh

Install ncat

# For Debian 8
$ sudo apt-get install nmap

# For Debian 10
$ sudo apt install ncat

# For Redhat based OS
$ sudo yum install nmap-ncat
# or
$ sudo dnf install nmap-ncat
[Read More]
ssh  proxy