解决git clone 速度慢的问题

利用国内镜像替换

github.com.cnpmjs.org
git.sdut.me

方法

#我们准备clone的链接
git clone https://github.com/example
#使用镜像
git clone https://github.com.cnpmjs.org/example

git push时登录显示密码错误

依次进入界面
image.png
image.png
image.png

全部勾选并生成token,token便是git push登录时需要输入的密码(只会出现一次,记得复制!

pip install git报错

利用git安装github上的项目报错
ERROR: Command errored out with exit status 128: git clone -q https://github.com/xxx/xxx.git /tmp/pip-req-build-88ue_mql Check the logs for full command output.

解决方法
将github网页中的http://换成git://

1
2
3
4
# 本来是
pip install git+http://github.com/xxx/xxx.git
# 改为
pip install git+git://github.com/xxx/xxx.git

解决 git 访问错误

参考链接:解决 git 报错

在国内访问 git 经常遇到访问报错,或者即使开了全局代理仍然访问失败,解决方法如下

方法一:取消代理设置

这是最常见的解决方法之一,通过在终端执行以下命令,可以取消 Git 的代理设置:

1
2
git config --global --unset http.proxy 
git config --global --unset https.proxy

方法二:设置系统代理

有时候取消代理设置仍然会出现报错,这时可以通过设置系统代理来解决。具体步骤如下:

  1. 在 win10/11 中的设置中搜索代理服务器

  2. 打开代理服务器,获取代理服务器的 ip 地址和端口(127.0.0.1:7890)

  3. 在终端输入以下命令,设置 Git 使用本地代理

    1
    git config --global http.proxy http://127.0.0.1:7890
  4. 设置完成后,可以通过以下命令检验是否设置成功:

    1
    git config --global -l