gitHub报错异常:[rejected]

$ git push -u origin master
To https://github.com/szySunzhouyu/python.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/szySunzhouyu/python.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.

出现问题的原因:

github中的有些文件不在本地代码目录中

解决办法:

$ git pull --rebase origin master  #执行这一步。

结果:

本地代码目录下出现gitHub中文件

此时 再执行以下操作 代码成功上传至github

 git push -u origin master




猜你喜欢

转载自blog.csdn.net/qq_33144323/article/details/80291547
今日推荐