我试图推向github 我按照以下步骤: (在这些行我位于我的app目录之前)
$ 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.
答案 0 :(得分: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