我已经解决了一些合并冲突,提交,然后尝试推送我的更改,并收到以下错误:
c:\Program Files (x86)\Git\bin\git.exe push --recurse-submodules=check "origin" master:master
Done
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 C:/Development/GIT_Repo/Project
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'C:/Development/GIT_Repo/Project'
有没有人知道是什么导致了这个错误?
发布于 2014-06-21 05:11:45
我解决了这个问题,首先验证遥控器没有检查出任何东西(它真的不应该有),然后让它暴露出来:
$ git config --bool core.bare true
在那次git推送之后,一切都很顺利。
发布于 2016-03-12 10:17:11
对我来说,下面的方法起到了作用:
git config --global receive.denyCurrentBranch updateInstead
我设置了驱动器F:,使用Git在我的Windows 10台式机和Windows 10笔记本电脑之间进行同步。我最终在两台机器上都运行了上面的命令。
首先,我在网络上共享了台式机的F盘。然后,我可以通过运行以下命令在我的笔记本电脑上克隆它:
F:
git clone 'file://///DESKTOP-PC/f'
不幸的是,所有的文件最终都在我的笔记本电脑上的" F:\ f“下,而不是直接在F:\下。但我可以手动剪切和粘贴它们。之后,Git仍然在新的位置工作。
然后,我尝试对笔记本电脑上的文件进行一些更改,提交它们,然后将它们推送回桌面。直到我运行上面提到的git config命令,这才起作用。
请注意,我在两台计算机上的Windows PowerShell中运行了所有这些命令。
更新:在某些情况下,我仍然在推动更改方面遇到了问题。我最终开始拉取更改,在我想要拉取最新提交的计算机上运行以下命令:
git pull --all --prune
发布于 2015-05-20 11:09:25
cd进入您在远程机器上推送到的repo/目录,然后输入
$ git config core.bare true
https://stackoverflow.com/questions/11117823
复制相似问题