创建项目时出现问题,大家看看我哪一步出错了
本地编写代码
github上创建新项目,并且用github直接 创建了readme.md
git remote add origin git@github.com:xxx/xxx
git push -u origin master
到这里,开始报错:
error: failed to push some refs to 'git@github.com:xxx'
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 the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
然后,git pull
,又报错:
warning: no common commits
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From github.com:xxx
+ 8324a8d...8c9fdd4 master -> origin/master (forced update)
fatal: refusing to merge unrelated histories
这到底哪里出错了?正确推送git项目的姿势是什么呀