好久不git这么多问题

本来想把本地项目上传GitHub一下,打开gitbash,

git init

之前配置过了 用户名和邮箱以及ssh等

$ git remote add origin https://github.com/ljt1018168/Myturn.js.git

建立连接;

git add .

git commit –m '20190101'

然后git push origin master 没有问题吧,我也觉得没有问题

然而额

hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate t he remote changes

hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

意思就是先让我pull下,

那我就 git pull origin master

$ git pull origin master

From https://github.com/ljt1018168/Myturn.js

* branch master -> FETCH_HEAD

fatal: refusing to merge unrelated histories

什么玩意拒绝合并?

好吧继续git保护措施防止你合并了不同的仓库。

强制一下:git pull origin master --allow-unrelated-histories

 

git push origin master就能ok啦

 

文章来源:刘俊涛的博客

欢迎关注,有问题一起学习欢迎留言、评论

原文地址:https://www.cnblogs.com/lovebing/p/10601094.html