Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git推入主控失败。。。_Git_Git Push_Git Remote - Fatal编程技术网

Git推入主控失败。。。

Git推入主控失败。。。,git,git-push,git-remote,Git,Git Push,Git Remote,我不确定从哪里搜索,因为错误列表与底部一样长。但总的来说,我就是这么做的 我所做的: git clone url . git add abc.txt git commit -m "testing" git push origin master / git push 错误: remote: error: refusing to update checked out branch: refs/heads/master remote: error: By default, updating the

我不确定从哪里搜索,因为错误列表与底部一样长。但总的来说,我就是这么做的

我所做的:

git clone url .
git add abc.txt
git commit -m "testing"
git push origin master / 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_abc/

你查过分行了吗

试一试

然后


您正在将
master
从克隆推送到源repo,其中源repo本身已签出
master
,并且源repo不是
bare
repo
GIT
不允许这样做

为了实现你的目标

或者使用一个你推动的裸中间回购协议,然后从该回购协议中退出。 论原产地回购

git remote add downstream <path/to/intermediate>
git pull downstream master    
git checkout master
git merge master_to_be_merged
或者忽略这些警告并按一下按钮 在这种情况下,您必须格外小心,不要损坏任何东西,无论如何,不建议这样做

在原始回购协议上,运行

git config receive.denyCurrentBranch ignore
现在从您的本地克隆开始,执行以下操作:

git push origin master

你正在克隆什么样的url?原始repo是裸repo吗?我不明白这个git克隆--裸中间层,中间层指向远程,它会直接将所有的.git文件复制到中间层,而不放入.git文件夹?谢谢,我的错。我不知道主人应该光着身子。但即使这就是为什么大部分教程都没有提到它的问题所在???@EricT我想,因为大部分教程都是为初学者准备的,而且初学者不使用github或类似的服务,而使用纯repos。
git remote add downstream <path/to/intermediate>
git pull downstream master    
git push origin master:master_to_be_merged
git checkout master
git merge master_to_be_merged
git config receive.denyCurrentBranch ignore
git push origin master