【发布时间】:2014-01-23 05:56:53
【问题描述】:
我在 Github 上创建了一个新的存储库,现在只有 Readme.md 文件。
我有一个新创建的 RoR 项目,我想将它推送到这个存储库。 以下是我在终端中执行的命令以及我遇到的错误。
git remote add origin https://github.com/aniruddhabarapatre/learn-rails.git
然后我输入了我的用户名和密码
git push -u origin master
错误---
To https://github.com/aniruddhabarapatre/learn-rails.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/aniruddhabarapatre/learn-rails.git'
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 merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这是我第一次将我的代码推送到 Github 存储库,我因错误而迷失了方向。我搜索了这里提出的其他几个问题,但没有一个是第一次遇到问题。
【问题讨论】: