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.
git – Well this tells that this is a git command. Used always with GIT, you know that.
config – Tells GIT that we are configuring something.
--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.
https.proxy – Tells GIT which parameter you’re configuring.
http:// – This is simply the protocol which you’re setting up.
https:// works too if your proxy server allows that.
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.
proxyaddress:port – Well, finally proxyaddress is your proxy address (E.g.
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:firstname.lastname@example.org:80
git config --global https.proxy https://064.34894:email@example.com: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!