git提交到远程仓库失败

在本地建立了仓库,远程也创建了项目。

然后将本地项目和远程项目关联。

git remote add origin https://gitee.com/xxxx/xxxxxx.git

关联后push代码出现下面错误。

 解决:

1) 先在本地pull远程项目

git pull origin master --allow-unrelated-histories

2)再在本地commit提交,然后push,最后提交成功。

原文地址:https://www.cnblogs.com/30go/p/13718520.html