创建github仓库的gh-pages分支

Posted 代码练习册

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了创建github仓库的gh-pages分支相关的知识,希望对你有一定的参考价值。

git symbolic-ref命令将当前工作分支由master切换到一个尚不存在的分支gh-pages。

$ git symbolic-ref HEAD refs/heads/gh-pages

删除暂存区文件,即相当于清空暂存区。

$ rm .git/index

创建项目首页index.html

$ printf "hello world.\n" > index.html

添加文件index.html到暂存区。

$ git add index.html

执行提交。提交完毕分支gh-pages完成创建。

$ git commit -m "branch gh-pages init"

执行推送命令,在github远程版本库创建分支gh-pages。

$ git push -u origin gh-pages

以上是关于创建github仓库的gh-pages分支的主要内容,如果未能解决你的问题,请参考以下文章