To 111.11.1.11:/home/git/hexo.git ! [rejected] master -> master (fetch first) error: failed to push some refs to '111.11.1.11:/home/git/hexo.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.
我是这样理解的,在 master 分支上,hexo d 推送的是静态文件,git push 推送的是源文件,远程和本地工作不一致才出现这种情况
hexo d 默认部署到 master 分支,因为站点文件 config.yml 最下面指定了 branch: master
git push 当然推送到 hexo 分支
因此hexo分支下可以执行以下命令而不需切换到master分支:
1 2 3 4 5 6
hexo clean hexo g hexo d git add . git commit -m 'hexo' git push
执行上面命令后如果正常就可以删除原来的hexo练习项目,使用刚拉取的项目
问题故障
hexo
第一次拉取源文件后,执行 git push 也出现过:
1 2 3 4 5 6 7 8
To 111.11.1.11:/home/git/hexo.git ! [rejected] master -> master (fetch first) error: failed to push some refs to '111.11.1.11:/home/git/hexo.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.