在使用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'.
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
我在git的初始化仓库的.git目录中的config修改加入以上配置并没有成功
而在git仓库的.git目录执行 git config receive.denyCurrentBranch ignore 之后
本地能成功推送到远程
具体原因不清楚,难道不应该是改仓库的config文件
分享到:
相关推荐
git 简单的向git服务器推送的过程, 可以参考一下
把本地现有的 代码通过ssh(git) 推送到 远程仓库,手把手教如何配置ssh命令以及怎么拉取代码,推送代码到远程仓库
远程推送仓库流程、git常见错误和git常用命令。git int (仓库初始化) git add . (提交整个项目所有代码)/git add 文件名等
git 本地提交到远程步骤git 本地提交到远程步骤git 本地提交到远程步骤git 本地提交到远程步骤
git 提交代码,自动推送代码到服务器
git 推送分支和变基rebase操作 强制push推送 master 到 其它分支是可以的。 但是,反过来不行,因为 maser 是受保护的。
Git常用的一些命令及其功能说明,是新手的好工具。通过该文档,新接触git的朋友可以很快的掌握日常Git用法,尽快上手。
Windows下实现的,git的自动拉取推送,svn的自动拉取和推送,maven自动编译,angular的自动打包发布,bat脚本
gitreceive, 轻松接受和处理任意git推送 gitreceive 创建在飞行库中接受并触发钩子脚本的ssh+git用户。在任意位置推送代码扩展你的Git工作流。gitreceive动态创建了一个特殊的pre-receive 钩子,可以以触发你自己的...
Android实例源码-消息推送通知栏类安卓源代码(5例) NotificationTest 消息推送的简单demo 实现Notification的通知栏常驻 消息推送完美demo 消息推送最新demo +服务器 激光推送客户端demo
gitwithJava 使用gitbash推送Windows 添加了新的自述文件
今天首次使用VS Code的Git功能,翻遍了 所有中文教程,竟没有一个靠谱的。遂动笔写一篇。 请确保你安装了最新的VS Code.http://code.visualstudio.com/ 请确保安装了最新版的Git。https://git-scm.com/download。git...
(以自己的方式进行) $ git init$ git remote add origin $ git add .$ git commit -m "first commit"$ git push origin master在gulpfile.js为您的推送任务创建一个任务。 或者克隆/下载到您的项目目录中。 进行...
当你辛辛苦苦地在Linux下架设好SSH服务器,给账户分配完权限,以为什么都大功告成的时候。 这时你在客户端的Linux机器下登陆,可是可是,... remote:error:blablabla remote:error:blablabla remote:error:blablabla
主要介绍了git push 本地项目推送到远程分支的方法(git命令版),需要的朋友可以参考下
git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git笔记git...
asp.net core 使用SignalR实现简单的消息推送: 1、简单在线聊天功能(推送消息给所有在线的客户端) 2、推送消息给指定用户(定向推送消息)
一种监视git存储库并自动提取和推送更改的工具
git相关的文档,包括文件提交和推送
一个小 gulp 模块,可让您将文件夹推送到 git 子树,而无需将该文件夹保留在您的 git 历史记录中。 强烈建议与一起使用。 重要的! 为了让 Gulp Subtree 正常工作,您推送的文件夹不能通过 GIT 被忽略。 通常,这是...