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 toremote: error: 'ignore' or 'warn' in the remote repository to allow pushing intoremote: 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 someremote: error: other way. remote: error: remote: error: To squelch this message and still keep the default behaviour, setremote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
当时查原因,看到大家都说需要给config文件中,最后加入
[receive]
denyCurrentBranch = ignore
这两行内容,我把git的配置文件,.gitconfig,以及本地的git仓库中的config文件都改了,还是没有好。最后我就去把远程的git仓库的config文件改了,在config文件后面加入了上面两行,保存退出。重新push,发现可以了。(这个config文件就是你的远程仓库的.git/config文件)
网友评论