试图将项目放在Github上

时间:2014-09-03 11:23:59

标签: git github

我正在尝试按照此处给出的说明将我的项目放在github上:https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line

但是不允许我在github上推送我的项目显示错误:未能推送一些引用。它还显示以下提示。

hint: Updates were rejected because the tip of your current branch is to be
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

**

我试图找出它的含义但却失败了。

请帮帮我

1 个答案:

答案 0 :(得分:1)

如果你创建了一个非空的GitHub仓库(即一个带有README.md.gitignoreLICENSE文件的仓库),就会发生这种情况:它至少有一次提交自己的。

一个简单的解决方案是删除/重新创建您的GitHub仓库(如果是新的),选择创建空仓库的选项。
更简单(如果您不想保留GitHub回购历史记录)

git push --force -u origin master

如果您无法触及GitHub仓库,则必须在git push之前添加:

git pull --rebase origin master

然后你可以做:

git push -u origin master

请注意-u选项:有关详情,请参阅“Why do I need to explicitly push a new branch?”。

相关问题