今天写了个小Demo,突然来了兴趣把它放到github上去,于是就凭着之前弄过的记忆搞了一下,但就在我准备push到github上的时候报错了,错误如下
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:mingmingsuper/FilePicker.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
执行过后会有如下结果输出:
First, rewinding head to replay your work on top of it...
Applying: 初始化
然后就解决这个问题了,就可以顺利的进行push了,大功告成。