我对自己的 github repo 做了一个本地克隆,做了一个不同的项目,现在我想把它作为一个新的 repo 推送到 github。我被迫先在 github 上创建一个空白仓库,然后推入它,因为通过推入它似乎不可能创建一个新的仓库。现在,当我这样做时,我会收到一条常见的错误消息:
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 matc
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'.
将远程(空)存储库克隆到一个虚拟分支(其他地方的建议)在这里不起作用,我也无法修改远程存储库的设置。我不想强迫任何事情,我希望历史清楚,有一次它是另一个 github 存储库。
我还尝试分叉原始的 github 存储库,并与之合并,但是在 github 上分叉我自己的存储库并没有做任何事情。
实现我想要的最好/最干净的方法是什么?