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

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

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 --命令的影响范围是全局所有用户
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值