fatal: unable to access ‘https://github.com/xxx‘: Failed to connect to github.com

Execute these two commands, and change the port number to the port of your proxy server (mine is 7890)

git config --global https.proxy 127.0.0.1:7890
git config --global http.proxy 127.0.0.1:7890

Read More: