$ git push origin master
Username for 'https://github.com': UserName
Password for 'https://UserName@github.com':
To https://github.com/UserName/tool.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/UserName/tool.git'
hint: Updates were rejected because the tip of your current branch is behind
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.
于是我试了 git pull
,跳出来让我 set up-stream
,set 完依然报错。
经过上网查阅,在 help.github.com 上找到了解决方案:
该方案解决了我遇到的 non-fast-forward errors
问题。
$ git push origin master
Username for 'https://github.com': UserName
Password for 'https://UserName@github.com':
To https://github.com/UserName/tool.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/UserName/tool.git'
hint: Updates were rejected because the tip of your current branch is behind
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.
$ git pull origin master
From https://github.com/UserName/tool
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
README.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
$ git push origin master
Username for 'https://github.com': UserName
Password for 'https://UserName@github.com':
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 700 bytes | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 1 local object.
To https://github.com/UserName/tool.git
0e079c8..98a504b master -> master
$