Git 相关问题及解决方案

Git Pull Failed Recv failure: Connection was reset

git pull 拉取代码时出现如下错误:

git pull failed 
unable to access 'repository url': Recv failure: Connection was reset

解决方法:

git remote remove origin
git remote add origin 你的仓库地址

No tracked branch configured for branch master or the branch doesn’t exist.

如果这时候报错,如下所示

Can't Update 
  No tracked branch configured for branch master or the branch doesn't exist.
  To make your branch track a remote branch call, for example,
  git branch --set-upstream-to=origin/master master (show balloon)

解决方法:

提示的比较明显了,就是需要本地库和远程分支进行关联;

执行如下命令,使本地库和远程分支进行关联

git branch --set-upstream-to=origin/master master

requested upstream branch ‘origin/master’ does not exist

这时如出现

requested upstream branch 'origin/master' does not exist

但是 origin/master 其实是存在的

解决方法:

git pull origin master --allow-unrelated-histories

再使本地库和远程分支进行关联

扫描二维码关注公众号,回复: 14950060 查看本文章
git branch --set-upstream-to=origin/master master

这里注意是什么分支就改为什么分支,比如你是dev分支,对应的就改为origin/dev dev

git push

解决上述问题就可以,推代码,也可以拉代码了

SSL certificate problem: unable to get local issuer certificate

如果在推代码或者拉代码的时候出现:

fatal: unable to access 你的仓库URL
SSL certificate problem: unable to get local issuer certificate

出现原因:

本地计算机上的SSL证书配置错误引起的,当推送、拉取或者克隆代码的时候,Git无法验证你的SSL证书,从而导致这个错误;

解决方式:

方式一:将Git的SSL证书(SSL certificate)拷贝到Git 安装目录中放置SSL证书(SSL certificate)的位置(推荐)

打开Git安装目录中存放SSL证书的地方,例如:

C:\Program Files\Git\mingw64\ssl\certs\

修改 ca-bundle.crt,把SSL证书(SSL certificate)添加到文件内容的末尾并保存

vi ca-bundle.crt

方式二:关闭SSL认证(不推荐,有安全问题)

git config --global http.sslverify false --命令的影响范围是系统当前用户
git config --system http.sslverify false --命令的影响范围是全局所有用户

猜你喜欢

转载自blog.csdn.net/chy555chy/article/details/128655431
今日推荐