通常在用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. 1078. Hashing (25)【Hash + 探測】——PAT (Advanced Level) Practise

    题目信息 1078. Hashing (25) 时间限制100 ms 内存限制65536 kB 代码长度限制16000 B The task of this problem is simple: in ...

  2. 大量原创视频教程分享(01)---XSL语法教程

    首先,感谢博客园给这个平台来发布这些教程.. 这些教程都是本人亲自录制的,时间主要是2012-2014年,大概有几十部这么多,可能有说的不对的地方,如果可以,感谢你的指正 本人也不想误人子弟,大部分教 ...

  3. C语言中的随意跳转

    C语言中有一个很不常用的头文件:setjmp.h. 这个头文件是C语言底层实现的,不像math.h里面的函数都是纯C语言实现的. setjmp.h包含两个函数: longjmp 跳转到某个位置 set ...

  4. iOS应用间相互跳转

    使用第三方用户登录,跳转到需授权的App.如QQ登录,微信登录等. 需要用户授权,还需要"返回到调用的程序,同时返回授权的用户名.密码". 应用程序推广,跳转到另一个应用程序(本机 ...

  5. Swift 类型检查与类型转换

    前言 在 Swift 语言中一般使用 is 关键字实现类型检查,使用 as 关键字实现类型转换,除此之外还可以通过构造器和方法来实现类型转换. 1.类型检查 1.1 使用 is 检查 类型检查操作符 ...

  6. Pusher 消息推送测试工具

    1.Pusher 简介 Pusher 是一款为 iOS.Mac App 提供推送测试的小工具. 其它下载地址 Pusher v0.7.3 for Mac,密码:p19i. 2.使用方法 使用方法简介 ...

  7. 【struts2】<s:url>标签

    <s:url>标签一般和超链接 <a>一起使用,用于带多个参数. <a href=" <s:url action=""> < ...

  8. golang 学习笔记 ---数组/字符串/切片

    数组 数组是一个由固定长度的特定类型元素组成的序列,一个数组可以由零个或多个元素组成.数组的长度是数组类型的组成部分.因为数组的长度是数组类型的一个部分,不同长度或不同类型的数据组成的数组都是不同的类 ...

  9. win8 应用商店程序使用SQLITE数据库

    http://www.cnblogs.com/zhuzhenyu/archive/2012/11/27/2790193.html using SQLite; using System; using S ...

  10. zookeeper注册中心安装(单机版)

    下载zookeeper-3.4.9.tar.gz wget http://apache.fayea.com/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar. ...