Ultimate Authority in Private Proxies

How to Use and Configure Proxy in Git?


Using a good proxy server like Limeproxies is very important because of the security and speed it offers you. As a programmer and service administrator for big establishments, you need git to help you save your coding, and monitor changes done on your file. It’s advantage can I be overemphasized and that is why over 37 million people use git and more than 100 repositories exist on github. In this article, you will learn how to use and configure proxy in git for both security and convenience..

Jump Directly to

1 . Detailed Steps on How to Use and Configure Proxy in Git

2. Git and A Proxy Server – How to Use and Configure Your Proxy With Git

3. Use Proxy with Git

An error message or trouble in cloning or fetching from a remote repository indicates the need to configure your proxy server in git. An example of the error you could get is unable to access ‘…’ couldn’t resolve host ‘…’

An error message of this sort is to be dealt with using the following action;

git config -–global http.proxy


If you are getting the difficulty for a specific domain, try something like:

git config –-global




git config –-global

http.https://domain.com.sslverify false


An advantage of setting http.<url>.sslverify to false is that if your workplace makes use of a man-in-the-middle HTTPS proxy, the setting may help you get along. You could get the root CA that is being applied to the certificate chain and with the use of either http.sslCAInfo or http.sslCAPath specify it in the long run.

Interesting Read : Step By Step Guide To Configure Apache Reverse Proxy

If you are experiencing HTTPS/SSL issues, you should check out the git config documentation of the following sections:

  • http.sslVerify
  • http.sslCAInfo
  • http.sslCAPath
  • http.sslCert
  • http.sslKey
  • http.sslCertpasswordprotected

Detailed Steps on How to Use and Configure Proxy in Git

The steps covered here include configuring the proxy, show configuration and how to unset a proxy or SSL verification.

1 . Configure the Proxy

You can set up a global proxy and configure these globally in your user ~/.gitconfig file with the use of –global switch, or locally to a repository in the .git/config file.

Configuring a Global Proxy

If all access to all repositories requires a global proxy, then you have to set one up.

git config –global http.proxy


Setting Up A URL Specific Proxy

You need to set up a URL specific proxy if you want to limit the use of the proxy for some URLs. This specifies the URL as a git config subsection using http.<url>.key notation.

git config –-global



Making this specification will have this result in the ~/.gitconfig file:


[http “https://domain.com”]

Proxy =


Handling Subsequent SSL Protocol Errors

If the problem of fetching or cloning continues and you are getting a response like unable to access ‘https://…’: unknown SSL protocol error in connection to …:443, then you have the choice of switching off SSL verification for the particular operation with the use of –c http.sslVerify=false

git –c http.sslVerify=false clone


After cloning, you may decide to set this for only this cloned repository .git/config. Notice that –global git config http.sslVerify false is absent.

If your choice is to make it global, you can use http.<url>.sslVerify to limit it to a URL:

git config –global

http.https://domain.com:sslVerify false

This will result in the appearance of the following in ~/.gitconfig


[http “https://domain.com”]

Proxy =


sslVerify = false

2. Show Configuration

If you want to see the current configuration of all http sections, this will take care of that:

git config –-global –-get-regexp http.*

For a locally cloned repository folder, you will have to erase –global to see the current configuration

git config –get-regexp http.*

3. How to Unset A Proxy or SSL Verification

The use of –unset removes the configuration that is specific to – whether it is http.proxy or http.<url>.proxy. The following are ways to unset a proxy or SSL verification:

git config –global –unset http.proxy

git config –global –unset http.https://domain.com.proxy


git config –global –unset http.sslVerify

git config –global –unset http.https://domain.com.sslVerify

Git and A Proxy Server – How to Use and Configure Your Proxy With Git

If you make use of a proxy server, then your internet goes through it. To use your proxy with git, you will need to modify git commands access remote repositories.

Interesting Read : How To Configure Proxy Settings in Windows 10?

It is common to find proxy servers being used in business environments and for the best proxy services, one of the best servers to choose is limeproxies. 

Finding your proxy settings is easy and is in your browser’s settings panel.

Use Proxy with Git

In order to configure your git, you will first need to obtain your proxy settings. Details that are necessary for the configuration are server URL, port, username and also password. You can configure your git as follows:

$ git config –global http.proxy http://<username>:<password>@<proxy-server-url>:<port>

In configuring, you will need to replace <username>, <password>, <proxy-server-url>, and <port> with the value you get from your proxy settings. It is also important to note that these fields are not compulsory to replace. What I mean is that your proxy server may not require any <username> and <password>, or may be running on port 8 and in which case the need for <port> is not necessary.

Once you are done modifying these settings, you can be rest assured that your git pull, git push and git fetch would function properly.

When to Avoid Using Git with Proxy

There are a few situations in which you should avoid using your git commands with proxy settings. You should avoid doing this if any of the following takes place:

1. Your corporate policy or system administrator doesn’t allow you access to the remote git repositories. Repositories could be from GitHub, BitBucket and others like this.

2. If the remote repository you want access to is not in your machine but within the internal network. An example of this is the deployment of GitLab internally at your company.

1. Unset Proxy Settings

If you added an entry to your git config file by mistake and want to correct this, you can manipulate both files from global and per-repository using git config. To find out if you actually made an error, run the following from your console:

Git config –l –global | grep http

If it is in the global config file

Git config –l | grep http

If it is in the local repository

This will print the line if there is an error in the config file. To then remove all the http.proxy entries from either a local or global file, run the following from your console:

Git config –global –unset-all http.proxy

This will remove it from the global config

Git config –unset-all http.proxy

This will remove it from the local repository file

2. How to Make Use of Git through a Proxy Server

In this section, I will explain how you can make use of git through a proxy. This is helpful if you are on a private network or behind a firewall.

Interesting Read : How Socks5 proxies solves online issues?

The examples that are used here are valid for connections inside the .cms network at point 5. It is not limited to this configuration as it can be easily adapted into other configurations also.

The most common types of proxy used with git are HTTP proxy and a SOCKS5 proxy.

How to Open A SOCKS Proxy Through SSH Tunnel

The ssh-command that is in most Unix-like systems can be used to open a SOCKS proxy on the local machine. It can forward all connections through the ssh tunnel. 

For instance 

Ssh –f –N –D 1080 cmsusr.cms

Will connect to cmsusr which is the host, will open a SOCKS proxy on the localhost on 1080 port (-D 1080), and allow the process in the background after connecting successfully (-f –N.

How to Use SSH Protocol to Connect To Git Repository

If the following format exists in the remote;



Then you are onto the git server with SSH protocol. In this case, ssh handles the connection. If you want to then connect through a SOCKS proxy, you will first have to configure ssh itself. This is done by setting the proxyCommand option in the file ~/.ssh/config

Host github.com

User git

ProxyCommand nc –x

Localhost:1080 %h %p


Alternatively, you can do the following on Cent0S7

Host github.com

User git

ProxyCommand ssh cmsusr nc %h %p

3. How to Use Git over Authenticated Proxy Connection

Git can be used to track the changes that take place on your computer files, and coordinates work on those files among multiple people.

There are two ways you can use git over the authenticated proxy connection:

1 . Making use of git configuration

2. Making use of environment variable

An advantage of using the environment variable is that other apps may also make use of the environment variable for connection.

Making Use of Git Configuration

To set up;

Git config –global http.proxy http://Username:Password@proxyServer:Port/

Git config –global https.proxy https://Username:Password@ProxyServer:Port/ 


An example of this can be seen in the following

Git config –global http.proxy http://2016ipg_047:PASSWORD@ 


To Verify

Git config –global –unset http.proxy

Git config –global –unset https.proxy


To remove

Git config –global –unset http.proxy

Git config –global –unset https.proxy


Making Use of the Environment Variable

In using the environment variable to option to use git over authenticated proxy connections, you have to;

1. Set HTTP_PROXY Environment Variable to 


2. Set HTTPS_PROXY Environment Variable to



To remove, delete the environment variables.

If you are using an unauthenticated proxy connection, you could just use ProxyServer:Port instead of http://Username:Password@ProxyServer:Port/ 


The use of git is very necessary as it allows you save your codes and retrieve information easily. You can work with others on the same file and get around it efficiently and for security, incorporating a proxy is what you should do. Using proxy with git is not an easy task and with the step by step explanation in this article about , you now know how to use and Set proxy in git.

About the author

Rachael Chapman

A Complete gamer and a Tech Geek. Brings out all her thoughts and love in writing blogs on IOT, software, technology etc

Ultimate Authority in Private Proxies