Same problem here, it turned out to be my incorrectly configured proxy settings, here's how to check and remove them.
First open your git config file.
vi ~/.gitconfig
and find out whether the [http]
or [https]
sections are set.
I used to set proxies for git due to slow access to Github in China, however, lately I changed my local proxy ports but I forgot my git settings.
If you have incorrect proxy settings and decide to remove it, simply execute:
git config --global --unset http.proxy
git config --global --unset https.proxy
Things will work just fine.