使用 git 进行 clone 项目或者 使用git 进行 pull 项目,push项目,可能会遇到很多的问题,比如说:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/XXXXX.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
OpenSSL SSL_connect: Connection was reset in connection to github.com:443
Failed to connect to github.com port 443 after 21146 ms: Timed out
…等等等等,其实大部分的原因都是网络的原因,可以分成下面两种情况进行处理:
- 使用的有 代理软件 :至少是可以访问github 畅通无阻的,但是clone pull push时候不能使用,这是因为进行这些操作的时候并没有使用代理。
- 本身就没有使用代理,github的原因,有时候网络,不太能访问到,可以在网上找一些代理的ip和端口。
解决办法:
配置代理:
git config --global http.proxy socks5 127.0.0.1:7890
git config --global https.proxy socks5 127.0.0.1:7890
git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890
7890是当前代理的端口,如果不能使用的话,就换成当前大家使用的代理端口,可以在自己使用的代理软件中看一下端口是多少:
最后可以检查一下:
git config --global --get http.proxy
git config --global --get https.proxy
撒花🎉🎉🎉