“任何起点都可以创造辉煌!”
前言
我一直想拥有一个个人主页,但因为懒、缺少服务器、域名等诸多原因,始终没有去写。后来发现在github上可以搭建免费的个人静态站点,于是按照官方教程初步搭建起了个简单的页面,这里简单地记录下关键步骤:
正文
1. 注册github账号
这个就不用多说了
2. 新建仓库
(例如:https://github.com/USER_NAME/REPOSITORY_NAME.git
)
3. 生成个人页面
这一步就可以直接用github提供的模板工具自动生成个人页面(仓库»Setttings»GitHub Pages» Launch automatic page generator)。
4. 同步到本地仓库
在本地执行以下脚本
git clone https://github.com/USER_NAME/REPOSITORY_NAME.git LOCAL_DIRECTORY
cd LOCAL_DIRECTORY
# Creates a master branch, without any parents (it's an orphan!)
git checkout --orphan master
# Remove all files from the old working tree
git rm -rf .
echo "My Page" > index.html
git add index.html
git commit -a -m "First pages commit"
git push origin master
当push到远程master分支后,就可以在https://USER_NAME.github.io/REPOSITORY_NAME
看到具体页面了。接下来像普通的github项目一样开发和提交即可。
后记
有了基本的页面,接下来可以找一个漂亮的jekyll模板,向里面填充内容就可以了。
更多关于GitHub Pages的细节请参考GitHub Help