GIT 1.9 - 远程:错误:'receive.denyCurrentBranch' [英] GIT 1.9 - remote: error: 'receive.denyCurrentBranch'
问题描述
当我尝试git push时,收到以下错误:
remote:error:拒绝更新签出分支:refs / heads / master
remote:error:默认情况下,更新非裸仓库中的当前分支
remote:error :被拒绝,因为它会使索引和工作树不一致
remote:错误:与你推送的内容相同,并且需要'git reset --hard'来匹配
remote:error:工作树头部。
remote:错误:
remote:错误:您可以在远程存储库中将'receive.denyCurrentBranch'配置变量设置为
remote:error:'ignore'或'warn',以允许推入
remote:错误:当前分支;然而,除非你
remote:error:安排它更新它的工作树来匹配你在
remote:error:other方面推送的内容,否则不建议这样做。
remote:error:
remote:error:为了压制此消息并保持默认行为,请将
remote:error:'receive.denyCurrentBranch'配置变量设置为'拒绝'。
所以,我的第一步是在这个论坛阅读很多内容,并试图从中找到一些结果谷歌。可悲的是我所发现的并不适用于我的情况。
我正在使用Linux x86并安装Git 1.9。
我可以 git clone
从我的服务器上运行一个仓库并在其中运行。
例如,我 touch testfile
在其中创建一个新文件。现在我将 git commit
这个文件。
在这一步之后我 git push
然后我得到错误代码。
我在其他文章中发现该问题已在git 2.3 我尝试了所有这些,并且错误总是相同的。 在服务器上config value ist: 和 > git status
中解决并且它应该有助于更改来自存储库的配置文件中 receive.denyCurrentBranch
的值。
有用的值应该是:拒绝
, updateInstead
和忽略$ c
is:
$ b
[receive]
denyCurrentBranch =拒绝
git分支
<$在客户端上, * master
分支主
您的分支在'起源/主'由1提交。
(使用git push发布你的本地提交)
出现任何时间,我真的不知道如何解决它。
我该如何避免该错误信息?
一般的最佳做法是在您的服务器上创建 裸回购库 ( git init --bare
或将现有的回购转换为空白回购),克隆它,添加并提交新文件,然后推送。
该推送不会出现您描述的错误消息。
请注意,任何功能( 2.3 receive.denyCurrentBranch updateInstead
或< 2.4推送部署)允许推送到非裸露的回购在Git 1.9中不存在。
您应该可以安装最新的Git 2.13从正确的ppa 。
I have an error using Git 1.9.
When I try to "git push" I receive the following error:
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'.
So, my first step was to read a lot here in this forum and tried to find some results from google. Sadly all I found was not working in my case.
I am working on Linux x86 and installed Git 1.9.
I can "git clone
" one repository from my server and work in it.
For example I "touch testfile
" in it to create a new file. Now I will "git commit
" this file.
After this step I "git push
" it and then I get the error code.
I found in other article's that the problem is solved in git 2.3
And that it should be helpful to change the value from "receive.denyCurrentBranch
" in the config file from the repository.
Helpful values should be: refuse
, updateInstead
and ignore
I tried all of them and the error will be always the same.
On Server the config value ist:
[receive]
denyCurrentBranch = refuse
and the "git branch
"
*master
On client the "git status
" is:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
So, the error will appear any time, I do not really know how to fix it yet.
How can I avoid that error message?
The general best practice would be to create on your server a bare repo (git init --bare
, or convert your existing repo to a bare one), clone it, add and commit new files and then push.
That push would not have the error message you describe.
Note that any feature (2.3 receive.denyCurrentBranch updateInstead
, or 2.4 push-to-deploy) allowing to push to a non-bare repo are not present in a Git 1.9.
You should be able to install the latest Git 2.13 from the right ppa.
这篇关于GIT 1.9 - 远程:错误:'receive.denyCurrentBranch'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!