我刚刚去了github并创建了一个新项目,到目前为止它只有一个自述文件和gitignore文件。但我在本地有一个项目,我使用
添加到gitgit push -u origin master
我想使用$ git push -u origin master
To https://github.com/user/project.com
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/user/project.com'
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.
推送我的项目但是收到包含此内容的错误消息
{{1}}
我理解这个错误背后的逻辑,但解决方案是什么? 我不想拉,因为它可能会删除我当地的.gitignore文件,无论如何在没有强制推动的情况下忽略它?
答案 0 :(得分:0)
更新:由于某种原因,此建议从其本地文件系统中删除了用户的文件。
在我调查时,我宁愿暂时搁置它...但我建议你不要按照我的回答。
这应该有效:
git pull (or I prefer git pull --rebase)
<manually resolve any conflicts by editing the text files>
git merge --continue (or git rebase --continue if you used rebase above)
git push