我不确定在哪里搜索,因为错误列表与底部一样长。但通常这就是我所做的。
我做了什么:
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/
答案 0 :(得分:3)
您正在将master
从您的克隆推送到原始仓库,原始仓库本身已签出master
,原始仓库不是bare
仓库。 GIT
不允许这样做。
要实现您的目标,
git clone --bare <origin/repo> intermediate
在您原来的本地回购
上git remote add upstream <path/to/intermediate>
git push upstream master
在您的原始仓库
git remote add downstream <path/to/intermediate>
git pull downstream master
来自当地的回购
git push origin master:master_to_be_merged
On origin repo
git checkout master
git merge master_to_be_merged
在这种情况下,你必须格外小心,没有任何事情发生,这无论如何都不推荐。
在原始仓库中,运行
git config receive.denyCurrentBranch ignore
现在从你的本地克隆,做
git push origin master
答案 1 :(得分:-1)
你看了一个分店吗?
尝试
git checkout your_branch (could be master)
然后
git add blah
git commit
git push origin master