0

我试图推送到 github 我按照以下步骤操作:(在这些行之前我位于我的应用程序目录中)

$ mkdir estaciones
$ cd estaciones
$ git init
>>Initialized empty Git repository in /Users/armandodejesussantoyareales/Documents/project_newbie/Estaciones/estaciones/.git/
$ touch README
$ git add README
$ git commit -m "phase 3 estaciones"
>>[master (root-commit) 4462be3] phase 3 estaciones
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100755 README

(我不知道那条消息是不是错误)

$ git remote add origin git@github.com:asantoya/estaciones.git
$ git push -u origin master

但我总是有同样的问题,迟到我输入我得到下一个错误

To git@github.com:asantoya/estaciones.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:asantoya/estaciones.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
4

1 回答 1

0

这意味着远程存储库已经有一个主分支,并且它在该分支中包含自从您提交到本地副本以来已添加的内容。这是指在https://github.com/asantoya/estaciones上可见的代码

首先从 github 克隆 repo,然后将更改添加到其中,然后推送:

git clone https://github.com/asantoya/estaciones.git
git checkout -b nameofyourbranch master

添加一些文件等。

git commit -a -m "Your commit message"
git push origin nameofyourbranch
于 2012-07-25T20:24:29.607 回答