So you came back to your college or in a new network and all of a sudden your GIT gives some error. Well, there can be several causes. One of those which I faced recently was proxy.

So what’s the breakthrough? It’s pretty easy. Open your git bash and enter following:

git config --global http.proxy http://username:password@proxyaddress:port

git config --global https.proxy https://username:password@proxyaddress:port

So what the hell is this? Well, let me explain every part of this.

1. git – Well this tells that this is a git command. Used always with GIT, you know that.

2. config – Tells GIT that we are configuring something.

3. --global – this is a switch that tells GIT that this configuration is global (throughout the system). This switch is optional and without this, it would affect configuration of only the current repository.

4. http.proxy or https.proxy – Tells GIT which parameter you’re configuring.

5. http:// – This is simply the protocol which you’re setting up. https:// works too if your proxy server allows that.

6. username:password – These are your username and password that you use to access your internet behind the proxy server. Note that these are optional only when you don’t need any credentials to access internet using the proxy address. Remember the : between the two.

7. proxyaddress:port – Well, finally proxyaddress is your proxy address (E.g. 10.1.1.10 or proxy4.bhu.ac.in – my college proxies) and then port is the port used which is generally 80 ( Use 80 if you’ve no idea about it )

And there you go! So the full sample would be something like

git config --global http.proxy http://064.34894:passwd43@10.1.1.21:80

git config --global https.proxy https://064.34894:passwd43@10.1.1.21:80

^ Don’t try exactly this. Change as needed!

Well now you’re once done and you get back to your home in a network where there is no proxy server, then you again start getting errors. So here is the simple code to remove the proxy configuration from GIT.

git config --global --unset http.proxy

git config --global --unset https.proxy

Here the switch --unset removes the particular configuration from GIT.

Any errors, any help, anything? Write a comment below and I’d be happy to help!

Leave a Reply

Your email address will not be published. Required fields are marked *