博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git错误记录
阅读量:7222 次
发布时间:2019-06-29

本文共 2798 字,大约阅读时间需要 9 分钟。

hot3.png

1.错误一:

今天在服务器上git pull是出现以下错误:

error: Your local changes to the following files would be overwritten by merge:

        application/config/config.php

        application/controllers/home.php

Please, commit your changes or stash them before you can merge.

Aborting

不知道什么原因造成的代码冲突,处理方法如下:

如果希望保留生产服务器上所做的改动,仅仅并入新配置项:

git stash

git pull

git stash pop

然后可以使用git diff -w +文件名 来确认代码自动合并的情况.

如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下:

git reset --hard

git pull

反过来,如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下:

git reset --hardgit pull

其中git reset是针对版本,如果想针对文件回退本地修改,使用

git checkout HEAD file/to/restore

2.错误二:

git-updating-currently-checked-out-branch-warning

Counting objects: 3, done.

Writing objects: 100% (3/3), 226 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error: 
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To git@192.168.45.42:teamwork.git
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'git@192.168.45.42:teamwork.git'

解决方法:

git config receive.denyCurrentBranch ignore 

这里详细记录下 

http://stackoverflow.com/questions/738154/what-does-git-updating-currently-checked-out-branch-warning-mean

根据stackoverflow上的讨论记录,默认的git init建立的仓库所处分支master的情况下不允许向自己的远程分支提交,

所以最终的解决方案是建立裸库 也就是 git init --bare 或者 git init --bare --share

3.错误三:

cannot-update-paths-and-switch-to-branch-at-the-same-time

$ git checkout -b test --track origin/masterfatal: Cannot update paths and switch to branch 'test' at the same time.Did you intend to checkout 'origin/master' which can not be resolved as commit?
解决方案:

git remote -v
git fetch origin

然后重新执行刚才的track命令,成功

4.错误四

error: Malformed value for push.default: simple error: Must be one of nothing, matching, tracking or current.
解决方案:

git config --global push.default upstream

5.错误五

提交后提示

fatal: recursion detected in die handler
问题原因:
问题原因是http.postBuffer默认上限为1M所致。在git的配置里将http.postBuffer变量改大一些即可,比如将上限设为500M:
git config --global http.postBuffer 524288000

转载于:https://my.oschina.net/dlpinghailinfeng/blog/309001

你可能感兴趣的文章
Css问题 margin float 文档流 背景图底部充满
查看>>
JS match() 方法 使用
查看>>
关于shopee平台接口(php)对接示例
查看>>
BNU OJ 51000 BQG's Random String
查看>>
PAT (Advanced Level) 1044. Shopping in Mars (25)
查看>>
hdu 1531 King
查看>>
***R
查看>>
Linux 源码编译安装mysql
查看>>
取消手机端页面长按图片出现保存或者图片被打开的方法
查看>>
关于图片居中问题
查看>>
并发下的死锁问题
查看>>
Winserver下的Hyper-v “未在远程桌面会话中捕获到鼠标”
查看>>
oracle体系结构基础
查看>>
有关TCP和UDP 粘包 消息保护边界
查看>>
Mono为何能跨平台?聊聊CIL(MSIL)
查看>>
安装scrapy问题:-bash:scrapy:command not found
查看>>
CentOS7 重置root密码
查看>>
博客作业四
查看>>
Scanner 输入---从键盘输入两个数进行相加
查看>>
test
查看>>