几个月前,我设法运行了cvs2git,并为一些代码创建了一个git存储库。我从cvs导入到一个专用服务器中,希望将其用作远程存储库。
今天,我第一次尝试从远程存储库进行克隆,并且能够成功克隆。然而,当我尝试将更改推回到远程存储库时,它似乎并不是空洞的,因为我得到了错误:
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'.经过研究,我认为问题在于我用cvs2git创建的存储库并不是空的。
那么,如何将更改推送到此远程存储库呢?我对git的(有限)理解是,每个克隆都是平等的,位于远程存储库的副本并没有什么特别的“特殊”。那么,我可以删除当前存在的内容,创建一个新的裸存储库,然后从远程客户端推送到远程存储库吗?
发布于 2012-03-31 07:47:27
那么我是否可以删除当前存在的内容,创建一个新的裸存储库,并从远程客户端推送到远程存储库?
是的,你可以做到这一点-事实上,这可能是最简单的方法。
https://stackoverflow.com/questions/9951486
复制相似问题