【发布时间】:2015-06-02 13:15:47
【问题描述】:
我编写了一个在线订餐系统,并将代码上传到 github。检查此link。
当我尝试从终端进行新提交时,它会返回以下错误。
Username for 'https://github.com': akulkarni9
Password for 'https://akulkarni9@github.com':
To https://github.com/akulkarni9/miniNet.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/akulkarni9/miniNet.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 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.
我使用以下命令进行新提交:git commit -m "second commit"git add --allgit push -u origin master
执行这 3 个命令时出现上述错误。我该如何解决?
【问题讨论】:
-
你需要先做一个
git pull。 -
正如错误试图告诉您的那样,您需要拉取远程发生的更改。
-
我想你的意思是先
add,然后commit。否则您的commit -m不会提交任何内容。