美文网首页
git push时报错

git push时报错

作者: 二傻吧 | 来源:发表于2019-01-19 12:04 被阅读0次
报错原图

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文件)

相关文章

网友评论

      本文标题:git push时报错

      本文链接:https://www.haomeiwen.com/subject/rugadqtx.html