我怎么才能有一个gh-pages分支?

ope*_*sas 8 github github-pages

我正在用javascript页面做一些基本的演示 - 使用github不仅作为源代码控制,还作为托管服务提供商.

我只想在gh-pages分支上工作,或者让它自动反映我对master的更改,无论更简单,更清晰.

我试图删除主分支,但它不会让我:

$ git push origin --delete master
remote: error: refusing to delete the current branch: refs/heads/master
To git@github.com:opensas/geo-demo.git
! [remote rejected] master (deletion of the current branch prohibited)
Run Code Online (Sandbox Code Playgroud)

我只想拥有一个分支(master或gh-pages)以及我提交的任何内容并推送到github页面.

完成此任务的最佳方法是什么?

Ian*_*sco 14

如果你想从GitHub中删除master,你必须转到GitHub并将gh-pages设置为默认分支.只有这样你才能删除master.


Kju*_*uly 5

尝试在repo的设置页面中将"Default Branch"设置为"gh-pages",然后删除master分支:

$ git push origin :master
Run Code Online (Sandbox Code Playgroud)

它应该有效.