将intellij idea中的module上传到码云gitee

首先选中要export to gitee的module,然后VCS,import into Version Control,Create Git Repository

将intellij idea中的module上传到码云gitee

之后先add,再commit。注意,在add之后,要删除掉无用的工程文件,比如从eclipse导入之后遗留的.setting文件夹,.classpath及.project文件。

参考:怎么用IDEA上传本地项目到码云/Github?

之后在码云上创建了一个项目,注意,有没有md文件这里,如果创建了md文件,那么后面提交就会麻烦一些。

 

之后,在intellij idea中

将intellij idea中的module上传到码云gitee

这里定义一个remote,选择SSH的

将intellij idea中的module上传到码云gitee

之后push,报错

Push rejected: eureka-server: push to eshop-eureka-server-origin/master was rejected

为啥呢?

原因是我们remote gitee有一个md文件,需要先更新gitee上的md文件,然后才能提交。

好,那先pull一下

结果还是报错:fatal: refusing to merge unrelated histories

 

参考:git无法pull仓库refusing to merge unrelated histories

结果

E:\develop_IJ\spring_cloud_demo\eureka-server>git pull eshop-eureka-server-origin master --a

llow-unrelated-histories

From gitee.com:constfafa/eshop-eureka-server

 * branch            master     -> FETCH_HEAD

error: Your local changes to the following files would be overwritten by merge:

        .classpath

Please commit your changes or stash them before you merge.

Aborting

 

也就是说我们add和commit的文件要一致,如果有文件add了但没有commit,说明没啥用,那就删除掉。

 

最后

将intellij idea中的module上传到码云gitee

成功pull下来README.md

 

也正常push了