linux 下在GITHUB上建立自己的网站

1.建立一个xxx.github.com 这样的资源仓库

2.然后用GITHUB里面的创建主页功能生成一个静态页面在master分支下。

3.在当前用户目录下 把项目检出到本地 git clone https://github.com/user/repo.git

# Clone our repo
# Cloning into 'repo'...
# remote: Counting objects: 2791, done.
# remote: Compressing objects: 100% (1225/1225), done.
# remote: Total 2791 (delta 1722), reused 2513 (delta 1493)
# Receiving objects: 100% (2791/2791), 3.77 MiB | 969 KiB/s, done.
# Resolving deltas: 100% (1722/1722), done.

4.cd repo

5.git checkout --orphan gh-pages    gh-pages分支 是切换分支

# Creates our branch, without any parents (it's an orphan!)
# Switched to a new branch 'gh-pages'

OR

git init //初始化

6.git rm -rf .# Remove all files from the old working tree

   # rm '.gitignore'


7.touch README //新文件

8.git add README //添加

9.git commit -a -m "First pages commit" //提交

10.git push origin gh-pages //推送到GIT的gh-pages库去(输入账户密码后就完成了)

11.在项目的根目录也就是master下从创建CNAME文件内容是你的域名 比如:www.google.com 然后重复7到10的步骤后,把域名做一个A记录到GITHUB的IP去。等GITHUB生效后,输入你的域名就可以访问到了。

 

是不是很简单的呢,赶紧试试吧。

原文地址:https://www.cnblogs.com/elson/p/2668058.html