Git——报错总结

前言

git相关的报错汇总

错误汇总

上传文件需要密码

问题原因

1. 全局初始化是未添加邮箱
2. 远程地址使用HTTPS 

解决方案

1.重新生成带有邮箱的公钥,并添加到平台 
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"
2.删除原有的版本仓库,并使用SSH的地址重新添加远程仓库.
$ git remote -v //查看远程仓库
$ git remote remove xxx  //移除
$ git remote add xx git@gitee.com:xxxxxxx/xxx.git //重新添加远程地址

fatal: refusing to merge unrelated histories

问题原因
合并时报错提示拒绝合并不相关的历史

解决方案

git merge origin/src  --allow-unrelated-histories

failed to push some refs to 'git@101.132.150.182:cpic/SCRM-Admin-Web.git'

$ git push origin za:za
To 101.132.150.182:cpic/SCRM-Admin-Web.git
 ! [rejected]        za -> za (non-fast-forward)
error: failed to push some refs to 'git@<地址>:<仓库>.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

问题原因

本地仓库和远程仓库联系断开

解决方法

1. 使用-f强制推送(不推荐该方法)
2. 拉取远程仓库到本地,重新建立 
  git pull <local-name> <remote-name>
  git add .
  git commit -m "xxx"
  git push <local-name> <local_branch_name>:<remote_branch_name>
3. $ git branch --set--upstream-to=origin/<branch-name> <branch_name> (对我无效)

fatal: unable to access 'https://github.com/wangyang0210/EasyBe.git/': OpenSSL SSL_read: Connection was reset, errno 10054

解决方法
关闭ssl的验证

git config --global http.sslVerify "false"
posted @ 2020-01-04 20:46  。思索  阅读(250)  评论(0编辑  收藏  举报