Porter Pan
摘要
每次编辑博文并通过命令部署网站到github page上时,我们想每天都能将改动后的博文备份到github的一个分支上,实现本地数据同步到云仓库中。
- 实现本地博客云同步到github page其他分支上
- 实现本地博客部署到github page上的master分支上
网站部署(建议隔段时间再部署到网站上,短时间内直接部署本地,本地浏览下就好
部署到网上
1 2 3 4 5
| 1 git clone -b proworking <我的github网站仓库:proworking> 2 git pull origin proworking 3 git checkout master 4 5 hexo clean && hexo g && hexo d
|
部署到本地
1 2 3 4
| 1 git clone -b proworking <我的github网站仓库:proworking> 2 git checkout master 3 4 hexo clean && hexo g && hexo d
|
实现从github上获取我仓库中的Proworking分支数据,病拉取到我的本地
- 将本地的博文再重新push到我的云仓库(proworking)
1 2 3
| git add . git commit -m "添加了:file1.md\file2.md" git push origin HEAD:proworking
|
其他注意事项
下面贴上我遇到的问题
可能会出现如下的不正常信息:
1 2 3 4 5 6 7 8 9
| Pertor@Pertor-PC MINGW64 /d/Github/smritipertor.github.io (master) $ git push proworking
fatal: 'proworking' does not appear to be a git repository fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
|
正确的解决办法是,命令中输入如下代码(加HEAD)
1 2
| Pertor@Pertor-PC MINGW64 /d/Github/smritipertor.github.io (master) $ git push origin HEAD:proworking
|
此时会输出正确的提示,具体提示信息如下:
1 2 3 4 5 6 7 8 9 10
| Enumerating objects: 1498, done. Counting objects: 100% (1480/1480), done. Delta compression using up to 4 threads Compressing objects: 100% (1219/1219), done. Writing objects: 100% (1461/1461), 1.17 MiB | 390.00 KiB/s, done. Total 1461 (delta 187), reused 1300 (delta 139) remote: Resolving deltas: 100% (187/187), completed with 10 local objects. To https://github.com/smritipertor/smritipertor.github.io.git 06b21dd..1ff56b7 HEAD -> proworking
|