原文链接地址:
http://blog.csdn.net/wby0322/archive/2010/10/14/5940018.aspx

在使用Git Push代码到数据仓库时,提示如下错误:

[remote rejected] master -> master (branch is currently checked out)

错误原型

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.1.X:/var/git.server/.../web

! [remote rejected] master -> master (branch is currently checked out)

error: failed to push some refs to 'git@192.168.1.X:/var/git.server/.../web'

错误原因以及解决

这是由于git默认拒绝了push操作,需要进行设置,修改.git/config文件后面添加如下代码:

[receive]

denyCurrentBranch = ignore

无法查看push后的git中文件的原因与解决方法

在初始化远程仓库时最好使用 git --bare init   而不要使用:git init

如果使用了git init初始化,则远程仓库的目录下,也包含work tree,当本地仓库向远程仓库push时,   如果远程仓库正在push的分支上(如果当时不在push的分支,就没有问题), 那么push后的结果不会反应在work tree上,  也即在远程仓库的目录下对应的文件还是之前的内容。

解决方法:

必须得使用命令 git reset --hard 才能看到push后的内容.

Git Push 错误 [remote rejected] master - master (branch is currently checked out) 无法查看push后的git中文件相关推荐

  1. git提交错误 [remote rejected] HEAD -> refs/xxx 原因以及解决方法

    今天向gerrit提交代码时,发生了一下的错误: error: unpack failed: error Missing tree be99d2d528be3ef6b4354fb88dd72059ee ...

  2. 解决git报错[remote rejected] HEAD -> master (pre-receive hook declined) error: failed to push some...

    git push 报错 ...[remote rejected] HEAD -> master (pre-receive hook declined) error: failed to push ...

  3. Git——git push 错误[error: src refspec master does not match any]解决方案

    问题描述 git push -u origin master error: src refspec master does not match any error: failed to push so ...

  4. 自己在服务端搭建git库,在客户端使用git push出现remote rejected的解决方案

    错误截图 ! [remote rejected] master -> master (branch is currently checked out) error: failed to push ...

  5. Git代码提交: [remote rejected] prohibited by gerrit: ref update access denied(二十二)

    0.如果Gerrit提交使用一下命令会报错 # git push origion master ! [remote rejected] master -> master (prohibited ...

  6. git提交错误 Remote reject HEAD - refs/for/master (change htto://gerrit.iot.cn/54 closed)

    Remote reject HEAD -> refs/for/master (change htto://gerrit.iot.cn/54 closed) Git提交代码,gerrit构建不通过 ...

  7. git push错误(fatal: The upstream branch of your current branch does not match)解决方案

    有时候通过git push命令时会提示不成功,错误提示如下: localhost:lean-server alioo$ git push fatal: The upstream branch of y ...

  8. git常见错误failed to push some refs to

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

  9. Gerrit评审报错[remote rejected] develop- refs/for/develop(no new changes)

    在使用Gerrit做评审的时候,在本次push有提交内容的情况下,遇到这个奇葩错误[remote rejected] develop-> refs/for/develop(no new chan ...

最新文章

  1. PHP的静态变量介绍
  2. 扩展SpringMVC以支持绑定JSON格式的请求参数
  3. 8月22-23日 首届IT管理技术大会
  4. 开发日记-20190601 关键词 读书笔记《鸟哥的Linux私房菜-基础学习篇》
  5. 4n35光耦引脚图_在选择光耦继电器的过程中需要注意哪些问题?-先进光半导体...
  6. 【渝粤教育】广东开放大学 数据结构 形成性考核 (24)
  7. js 给动态li添加动态点击事件
  8. 打印出数字字符串的偶位数
  9. 2016 pku campus/OpenJ_POJ - C16H(推公式+矩阵快速幂)
  10. C++:mutable关键字
  11. Virtualbox 2.1突发性错误解决办法(也许是BUG)
  12. SQL-SERVER2008登录错误233
  13. python :super 的作用
  14. 力扣两数之和jAVA_力扣----1.两数之和(JavaScript, Java实现)
  15. C#集成FastDFS断点续传
  16. cisco下模拟Linux防火墙,Cisco防火墙HA实例
  17. docker 仓库镜像 替换_Docker如何制作自己镜像并上传dockerhub
  18. NSDate中夏令时的坑你知道吗
  19. 金田新材冲刺上交所:拟募资15.6亿 方文彬家族控制62%股权
  20. 在linux上挂载ntfs分区

热门文章

  1. 关于Gmsh使用Full_Blosson三角形合并为全四边形以及波前法、Delaunay和自适应算法测试
  2. html5 css3光晕
  3. CCSP2019T2_纸牌计数 | 2019苏州CCSP大学生计算机系统与程序设计竞赛
  4. 3D人体和手势运动估计
  5. c#winform开发中DialogResult的用法
  6. 知名动画公司访华,绘王发布新款INSPIROY Q11K数位板
  7. Android Stdio 控制STM32开发板
  8. OpenCV 学习记录7 图像实时磨皮及皮肤检测
  9. 宿迁中学2021高考成绩查询,江苏省宿迁中学举行2021届高三学生高考出征大会
  10. php filereader,new FileReader()