有时候我们使用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 [email protected]:/var/git.server/.../web

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

error: failed to push some refs to '[email protected]:/var/git.server/.../web'     这是因为git默认是拒绝push操作的,我们在.git/config里面添加如下配置项即可:

[receive]

denyCurrentBranch = ignore      这是当我们初始化一个远程仓库的时候,使用git  --bare  init即可了,而不是使用git  init,这样那么该远程仓库的目录下,也包含work  tree,当本地仓库向远程仓库push时,如果远程仓库正在push的分支上时,那么push后的结果不会反映在work  tree上,也就是在远程仓库的目录下对应的文件还是之前的内容,必须使用git  reset  --hard才能看到push之后的内容。

注意如果当时不在push的分支上,是没问题的。

原文:http://blog.csdn.net/xinguimeng/article/details/45460491

git push 拒绝连接_git push被拒绝的处理方式相关推荐

  1. git推送密码_git 学习小记之记住https方式推送密码

    昨天刚刚学了点git基础操作,但是不幸的是Git@OSC给出公告说尽量使用 https 进行操作. 可是在用 https 进行 push 时,都需要输入帐号和密码. 各种百度谷歌之后在Git@OSC官 ...

  2. git 怎么回退已经push的版本_git push 操作代码回退

    (1)改完代码匆忙提交,上线发现有问题,怎么办? 赶紧回滚. (2)改完代码测试也没有问题,但是上线发现你的修改影响了之前运行正常的代码报错,必须回滚. 这些开发中很常见的问题,所以git的取消提交, ...

  3. 解决git下载出现:Failed to connect to 127.0.0.1 port 1080: Connection refused拒绝连接错误

    解决git下载出现:Failed to connect to 127.0.0.1 port 1080: Connection refused拒绝连接错误 文章目录: 一.git拒绝连接原因分析 二.错 ...

  4. 三种方法解决git拒绝连接问题fatal: unable to access xxxx: Failed to connect to xxxx : Connection refused

    git clone 拒绝连接,Connection refused 解决方法 一.使用env指令查询系统代理并取消对应http代理 二.使用git config指令查询代理并取消代理 三.直接修改.g ...

  5. ROS中键盘控制节点功能包下载(下载过程中git时出现拒绝连接的最终处理办法)

    在ros中运行sudo teleop_twist_keyboard teleop_twist_keyboard.py时,出现找不到功能包错误,如下 解决问题过程: 1.首先,我现在文件中搜一下这个功能 ...

  6. 三种方法解决git拒绝连接问题fatal: unable to access xxxx: Failed to connect to xxxx : Connection refused

    git clone 拒绝连接,Connection refused 解决方法 一.使用env指令查询系统代理并取消对应http代理 二.使用git config指令查询代理并取消代理 三.直接修改.g ...

  7. git push命令_Git Push命令解释

    git push命令 The git push command allows you to send (or push) the commits from your local branch in y ...

  8. git 怎么回退已经push的版本_Git版本回退

    Git版本回退 Git中,每次commit提交都会生成一个历史纪录.使用 git log 查看commit历史:1 2 3 4 5 6 7 8 9 10$ git log --oneline ec88 ...

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

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

最新文章

  1. 批处理命令 / rd 和 del
  2. SAP Spartacus OCC 请求头部的 Access Token 是如何被添加的
  3. 什么是互联网保险平台?
  4. jquery获取元素索引
  5. transaction缩写为什么是tx_TX Transaction locks常见的4种情况
  6. Android Builder模式
  7. 计算机网络哈勃,NASA已基本确认哈勃故障原因 出在电源控制单元上
  8. 失败的过去式英文翻译_过去式用英语怎么说
  9. Python基础——类和对象与魔法方法
  10. vim超实用指南收藏这一篇就够了
  11. 共享服务中心建设原则
  12. 计算机操作系统u盘的安装方法,怎么直接用u盘装系统操作教程
  13. Unity 雨水滴到屏幕效果
  14. 详解APP应用分发平台的榜单推荐和搜索排名规则
  15. 怎么识别图片上的文字?告诉你3款简单又实用的识别软件
  16. 华容道3x3的技巧_华容道游戏秘决技巧
  17. 可穿戴产品中四大心率监测方法盘点
  18. 【ELT.ZIP】OpenHarmony啃论文俱乐部——多维探秘通用无损压缩
  19. 一个程序员,写在告别程序员生涯时说的话
  20. IT人生知识分享:博弈论的理性思维

热门文章

  1. 如何实现汇川PLC和工业机器人的协议解析与数据采集?
  2. 三维点云数据集汇总(分类+检测+识别)
  3. 德国精品软件 小红伞杀毒软件 AntiVir
  4. BZOJ3730 震波+BZOJ4372 烁烁的游戏(动态点分治)
  5. uni-app 实现在做下一个请求时中止当前的请求
  6. 三菱fx3u模拟量FB 输入输出功能块程序
  7. 在java中 以下关于集合框架_在Java中LinkedList类和ArrayList类同属于集合框架类,下列...
  8. u盘插linux电脑不好使,u盘插电脑没反应怎么办的几种真正解决方式
  9. COB-ID的简单理解分析
  10. 【Django】模板