git did not exit cleanly (exit code 1) 的解决办法

问题描述:

    关于Git的使用,在通常情况下,习惯于先在本地创建一个本地仓库,然后将项目提交到本地master,再将本地master中的项目Push 到远程仓库中,这样问题就来了。

具体错误信息如下:

git.exe push --progress "origin" master


To https://github.com/Jackson-AndyLau/CMSManager.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Jackson-AndyLau/CMSManager.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 


git did not exit cleanly (exit code 1) (12359 ms @ 2018-07-01 09:41:24)

 

如下图所示:

 

 

 

 

 

解决办法:

    关于这个问题,在网上搜罗了一下,很多工程师都遇到过,解决方法也是五花八门,要不删除一些文件,要不修改一些配置文件,但最终还是未能解决问题。

    后来经过多次的尝试,终于找到了解决办法,这儿分享出来,希望能帮助到你,能少花费些时间去看那些无用的方法!!!

1、根据错误内容提示,先将远程新建的空仓库 “ Clone ” 到本地,会得到一个空的与远程仓库对应的目录,如下图:

 

 

2、然后将文件提交到master,再Push到远程仓库,发现问题解决了额, 如下图:

 

 

再看远程仓库:

 


————————————————
版权声明:本文为CSDN博主「csdn-华仔」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/hello_world_qwp/article/details/80872257

posted on 2019-12-13 18:35  上校  阅读(6993)  评论(0编辑  收藏  举报