git push时报错

报错原图

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

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容