远程仓库通过git init初始化了一个项目,没有clone到本地,本地新建了一个项目,关联本地项目和远程仓库(参见IDEA新建本地项目关联远程git仓库 )后git push报错:

wulf@wulf00 MINGW64 /e/workspace/开源/spring-cloud-gateway (master)
$ git push --set-upstream origin master
git@111.11.11.11's password:
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (21/21), 2.17 KiB | 246.00 KiB/s, done.
Total 21 (delta 1), 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 t
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int
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 som
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, se
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To ssh://111.11.11.11:111/home/git/repository/spring-cloud-gateway.git! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://git@111.11.11.11:111/home/git/repository/spring-cloud-gateway.git'

  进入远程仓库,修改config文件:

[root@VM-0-14-centos /]# cd /home/git/repository/spring-cloud-gateway.git/.git
[root@VM-0-14-centos .git]# vi config[core]
[core]repositoryformatversion = 0filemode = truebare = falselogallrefupdates = true
[receive]denyCurrentBranch = ignore

  新加标黄部分,保存,本地重新发起git push成功:

wulf@wulf00 MINGW64 /e/workspace/开源/spring-cloud-gateway (master)
$ git push --set-upstream origin master
git@106.53.42.25's password:
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (21/21), 2.17 KiB | 221.00 KiB/s, done.
Total 21 (delta 1), reused 0 (delta 0)

git push报错:remote: error: refusing to update checked out branch: refs/heads/master相关推荐

  1. git push时出现错误refusing to update checked out branch: refs/heads/master

    错误描述 使用tortoisegit push的时候如下错误 Writing objects: 100% (3/3), 258 bytes | 0 bytes/s, done. Total 3 (de ...

  2. 【git私服推送文件出现的问题】refusing to update checked out branch: refs/heads/master

    "remote:error:refusing to update checked out branch:refs/heads/master"的解决办法 转载:http://www. ...

  3. git push报错 emote: error: GH007

    报错信息: Pushing to https://github.com/***.git POST git-receive-pack (1288 bytes) remote: error: GH007: ...

  4. git push报错:error: failed to push some refs to ‘https:/

    解决在git push时的报错:error: failed to push some refs to 'https:/ // 错误如下 hint: Updates were rejected beca ...

  5. git push报错 ! [remote rejected] master -> master (push declined due to email privacy restrictions)

    使用push命令 将本地仓库push到github时 报错: git push https://github.com/lexsaints/taobao_spider.git master 报错信息如下 ...

  6. repo upload 或者git push 报错“remote: (W):commit subject 65 characters,use shorter first paragraph”

    遇到问题: Repo upload pre-hook check report:         Git (ambarella/include): Pass         Git (kernel/l ...

  7. git pull 时候报错Your configuration specifies to merge with the ref ‘refs/heads/master‘ from the remote,

    使用vscode 拉代码报错,可以先在创建仓库的时候 点击 初始化readme文件再下拉代码 即可

  8. phpstorm 用git pull或者 git push报错 protocol error: bad line length character: Acti

    首先排除是ssh的key的配置问题,因为用git本身可以正常pull和push 解决方案: 在phpstorm中配置git 选择SSH executable 从 Built-in 改为 Native ...

  9. git push报错 protocol error: bad line length character: Acti

    idea配置git 选择SSH executable 从 Built-in 改为 Native 重启idea即可

最新文章

  1. rbpf粒子滤波slam matlab程序_学习笔记(优达学城)- 车辆定位之粒子滤波器(整合版)...
  2. SAP Spartacus 如何借助env-cmd 实现 B2B 和 B2C 功能启动的无缝切换
  3. 久玩玉之魂服务器维护,玉之魂1级到57级挂机心得详情分享
  4. 04_SSM整合ActiveMQ支持多种类型消息
  5. 个推Node.js 微服务实践:基于容器的一站式命令行工具链
  6. 面试题 php随机获取概率结果
  7. Spring Boot Admin 的使⽤
  8. collection集合 地址_有容乃大--Java 集合(List/Set/Map)
  9. BZOJ1036[ZJOI2008]树的统计——树链剖分+线段树
  10. Android开发笔记(二十四)res目录的结构与配置
  11. error log php 邮件,error_log()怎么向外发送邮件。
  12. java怎么实现直方图均衡化_直方图均衡化原理与实现
  13. 冲激函数和傅里叶变换
  14. STM32+IAP方案 实现网络升级应用固件
  15. 何钦铭c语言第三版第9章答案,c语言程序设计第3版何钦铭 颜 晖 第9章 结构.pdf...
  16. Android前端通过Http协议与J2EE后端数据交互。工具eclipse、MySQL、Tomcat。通过JoSn获取数据。Android端实现对MySQL增删改查功能。
  17. 解析春运玄学:携程飞猪去哪儿们的抢票加速包,到底灵不灵?
  18. 简单的tcpdump抓包使用总结:抓取指定ip、指定网卡、指定端口的包
  19. scara机器人dh参数表_SCARA机器人技术参数.docx
  20. 二维码生成插件qrious(纯JS)

热门文章

  1. 【开源之路】温蒂、一次简单的尝试
  2. 编辑距离(Edit Distance)
  3. 当AI开始寻找抗生素:人类终于摘取“高悬的果实”?
  4. 安卓插件化开发!我的头条面试经历分享,含爱奇艺,小米,腾讯,阿里
  5. 运行pytorch时报错——AttributeError: module 'torch.nn' has no attribute 'ModuleDict'
  6. Python爬虫脚本,利用Beautifulfly爬取动态网页网页(源码)
  7. 全志V3S嵌入式驱动开发(esp8089 wifi驱动)
  8. R语言怎么比较两个模型C指数,手把手教你比较两个模型的预测能力
  9. 动态ip地址有什么优缺点!
  10. 五十、头文件和源文件的区别和规范(extern)