github 除了可以用来 host 你的代码的Repository , 也可以用来host 一个static 网站。
假设你的网站完全没有用到后端的processing , 只有前端例如 HTML, Javascript 和 CSS 的话, 基本上可以用 github 的 gh-pages 来host
例如我之前做的 狗狗冒险记 的小游戏
http://tensaix2j.github.io/dogewarrior/
好处是自己不用买vps, 而且github 的uptime 相对可靠, 不用maintenance
非常简单, 假设你的代码repository 的 url 是
https://github.com/tensaix2j/dogewarrior
那么, 你首先需要开一个新branch 叫做 gh-pages ,
一旦有了 gh-pages 这个 branch, 你就可以用这个url 去access 项目以下的 static resources 了
https://用户名.github.io/项目名/任何static resources 例如 png,html,css,js, etc...
Example:
https://tensaix2j.github.io/dogewarrior/
就会直接用 gh-pages branch 里的 https://github.com/tensaix2j/dogewarrior/tree/gh-pages 的 index.html
可以参考上回写的这篇
https://steemit.com/cn/@tensaix2j/bypass-cors-same-origin-security-policy
谢谢阅读。