1.问题描述
$ git push -u origin masterTo github.com:[github_name]/[github_repository_name].git ! [rejected] master -> master (non-fast-forward)error: failed to push some refs to 'git@github.com:[github_name]/[github_repository_name].git'hint: Updates were rejected because the tip of your current branch is behindhint: 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.
2.问题原因
看错误原因 “Updates were rejected because the tip of your current branch is behind”,导致问题的原因是创建 repository 时选择创建 README 因此导致 github 与本地无法同步
3.解决方案
使用下面的命令,将两端同步即可!
git pull --rebase origin master
然后再使用 git push -u origin master
可以发现能够正常 push 了。