通常在用git clone了remote端(服务器)的git仓库后,再进行了自己一系列修改后,会将自己测试后稳定的状态push到remote端,以更新源仓库,使 其他人在pull的时候得到自己的修改。但是在git push的时候会经常出现如下的错误提示。

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’.

根据上面所报的信息,它的意思就是默认情况下,git不允许用push操作更新non-bare的仓库,因为这样的操作会导致remote仓库的索引 (index)和工作树(work tree)与你push的不一致,此时需要通过‘git reset –hard’操作来使得工作树与HEAD索引相匹配。 可以通过在remote端,设置git的配置文件(.git/config),在其中添加如下内容: [receive]

[receive]
denyCurrentBranch = ignore

这样就可以通过git push提交自己的稳定更新,要想在push后在remote端看到更新的效果,执行git reset –hard即可。

ssh://root@xxx.xxx.xxx.xxx:/data0/htdocs/order

git push remote error解决办法的更多相关文章

  1. git push失败的解决办法(2)

    错误一:Cannot rebase: You have unstaged changes 解决办法: Cannot rebase: You have unstaged changes. 那说明有修改过 ...

  2. git push出错的解决办法

    今天push代码到线上的时候怎么都不行,尝试了很多办法报了好几种错比如: 反正就是各种错,然后其实不管什么错,你全部Git init 一下然后重新配置 git config --global user ...

  3. unable to access 'https://github.com/shixianqing/img.git/': SSL connect error 解决办法

    解决在linux环境下,git clone 项目,走https协议时,报SSL connect error 错误 升级nss yum update -y nss curl libcurl

  4. windows下git bash中文乱码解决办法

    一.解决办法1:(直接上图) 1.在git bash下,右键 出现下图,选择options: 2.选择“Text” 3.将“Character set”设置为  UTF-8 转:windows下git ...

  5. git push throws error: RPC failed; result=22, HTTP code = 411的解决办法

    原因:默认 Git 设置 http post 的缓存为 1MB,将其设置为 500MB 解决办法如下: git config http.postBuffer 524288000

  6. Git - could not read Username for 'https://github.com',push报错解决办法

    执行git push命令异常,如下: git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sou ...

  7. 解决git push出现error: failed to push some refs to 错误

    错误截图 背景 码云上创建了空项目 本地项目绑定了远程仓库,尝试git push,然后报了错 解决办法 使用强制命令git pull origin master --allow-unrelated-h ...

  8. git学习之冲突解决办法

    1.如果本地项目和远程服务器的同一文件都有改动,那么就会产生冲突,导致git pull 失败,报错见下. 解决办法:先执行git stash指令,暂存当前的改动状态,再执行git pull指令,就可以 ...

  9. Linux] Git: push 出错的解决 master -> master (branch is currently checked out)

      在使用Git Push代码到数据仓库时,提示如下错误: [remote rejected] master -> master (branch is currently checked out ...

随机推荐

  1. 设置mysql group_concat长度

    #在MySQL配置文件(my.ini)中默认无该配置项,使用默认值时,值为1024,可在客户端执行下列语句修改: #SET GLOBAL group_concat_max_len = 1024; #该 ...

  2. 在发送信息时应用PendingIntent.FLAG_UPDATE_CURRENT

    1. 连续发送两条信息时,出现bug.以下是bug现象描述. 发送第一条信息,sentReceiver弹出toast告知发送成功,同时在listview中的发送状态立即同步更新为发送成功. 继续发送第 ...

  3. MessageListActivity has leaked IntentReceiver

    1. 在MessagelistActivity中出现has leaked IntentReceiver的异常.异常日志如下. 07-15 08:09:53.211: E/ActivityThread( ...

  4. 【laravel5.*】运行 php artisan --version报错:PHP Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in /www/web/crm/artisan on line 31

    1. 出现以上问题 是因为 php版本低于5.6, 因为我系统原有的默认php是5.3,装laravel的php是指定的5.6.21版本,所以在执行 laravel对应的php artisan . p ...

  5. ios中VRGCalendarView日历控件

    http://pan.baidu.com/share/link?shareid=4166002480&uk=923776187 官网 https://github.com/TjeerdVuri ...

  6. Redis学习之路(002)- Ubuntu下redis开放端口

    Redis在ubuntu安装后默认是只有本地访问,需要别的ip访问我们需要修改redis的配置文件 1. dpkg -L redis-server 这命令我们可以看到redis的安装的文件在那些目录 ...

  7. 问题 “No mapping found for HTTP request with URI [/fileupload/upload.do]” 的解决

    是因为自己springmvc的配置文件里面不小心删除掉了 <!-- 注解扫描 扫描该包下的注解--> <context:component-scan base-package=&qu ...

  8. 【Java】解析Java对XML的操作

    目录结构: contents structure [+] 什么是XML 解析XML 使用DOM解析 使用SAX解析 使用PULL解析 使用dom4j解析xml dom4j的部分API 打印一个XML文 ...

  9. iOS中app的分发测试

    知识的学习在于分享.分享出来才能共同进步. 关于测试 有几种方式 1.开发人员直接在电脑上 用模拟器 2. 真机调试,测试人员可以拿着测试机找开发人员在电脑上跑真机测试 3. 公司和个人账号  直接 ...

  10. UIView的transform

    iOS开发UIView的transform属性详解 本文主要是详解iOS开发UIView的transform属性 CGAffineTransform实际上是一个矩阵 | a,  b,  0 | | c ...