idea提交代码失败

使用idea,先讲本地代码进行git管理,然后commit。然后配置远程remote地址,远程上增加项目,然后将本地代码提交到git远端,这时候是两个不同的库,关联不上。

push的时候报错 refusing to merge unrelated histories 

参考如下两篇文章。需要使用命令git pull origin master -–allow-unrelated-histories(注意allow前是两个横杠),先将远端的代码拉倒本地。然后才能提交到远程!

https://blog.csdn.net/u012145252/article/details/80628451

https://www.cnblogs.com/xiangxinhouse/p/8254120.html

原文地址:https://www.cnblogs.com/havenenjoy/p/10298425.html