我有一個遠程和本地git存儲庫。
本地存儲庫是來自遠程的克隆。
當我修改我的本地存儲庫並提交到主分支。
然後我運行「git push」到遠程存儲庫。
但它失敗並輸出以下消息。git推送到遠程主分支
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 t
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int
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 som
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, se
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
我「git checkout -b current」遠程倉庫中的另一個分支。
在我的本地存儲庫中,我運行「git push」,然後成功。
但本地修改只推送到遠程主分支。
然後,我應該在遠程存儲庫中運行「git merge master」來進行更改。
我是新手混帳。
我做錯了嗎?
可能重複 - >主(分支當前檢出)'](http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked) – eckes 2012-07-27 05:37:28
與http:// stackoverflow相同。 com/questions/11395398/git-push-failing-refusing-to-update-checked-out-branch,http://stackoverflow.com/questions/11117823/git-push-error-refusing-to-update-checked- out-branch,http://stackoverflow.com/questions/8985782/git-push-fails-refusing-to-update-checked-out-branch-refs-heads-master – eckes 2012-07-27 05:37:59