报错提示fatal: unable to access https://github.com/xxx: Failed to connect to github.com port 443 after 21079 ms: Could not connect to server Pushing to https://github.com/xxx查看当前 Git 代理配置git config --global --get http.proxy git config --global --get https.proxy如果输出为空则未设置代理。如果代理正在运行例如本地代理监听 127.0.0.1:7890设置git config --global http.proxy http://127.0.0.1:7890 git config --global https.proxy http://127.0.0.1:7890根据实际代理的地址和端口修改常见端口7890、1080、10809 等。如果不需要代理或代理已关闭但之前配置过取消设置git config --global --unset http.proxy git config --global --unset https.proxy简约实现代理有事会影响其他网址的访问来回切换太麻烦以下是更优实现仅对 GitHub 特定域名设置代理git config --global http.https://github.com.proxy http://127.0.0.1:7890 git config --global https.https://github.com.proxy http://127.0.0.1:7890编写批处理脚本自动执行命令新建一个文本文件命名为 push.bat写入以下内容echo off git config --global http.proxy http://127.0.0.1:7890 git config --global https.proxy http://127.0.0.1:7890 git push %* git config --global --unset http.proxy git config --global --unset https.proxy