1. 在www.github.com註冊一個賬戶;
2. 創建一個代碼倉庫:
步驟1:Repositories --> New
步驟2:Repository name --> 填入一個倉庫名,格式爲:MYSITE.github.io,MYSITE替換爲你需要的二級域名
步驟3:其它設置採用github的默認設置 --> Create repository
步驟4:在剛纔創建的repository中創建文件index.html
<html>
<head>
</head>
<body>
Hello, myHtml in Github.
</body>
</html>
步驟5:在剛纔創建的repository中創建文件CNAME,輸入你擁有的頂級域名,格式爲www.MYSITE.com,MYSITE替換爲你需要的二級域名,然後保存文件;
3. 設置你頂級域名的DNS和域名解析功能
步驟1:進入你買域名的服務商提供的域名後臺控制中心,
步驟2:域名DNS的設置如下:
f1g1ns1.dnspod.net
f1g1ns2.dnspod.net
步驟3:域名解析的設置,添加記錄如下:
記錄類型 | 主機記錄 | 記錄值 |
A | @ | 192.30.252.153 |
A | @ | 192.30.252.154 |
CNAME | www | MYSITE.github.io(你在Github的二級域名) |
4. 設置保存之後,一般需要等待10分鐘-24小時內生效,具體時間取決於域名服務商的處理。
參考資料:
GitHub.com Troubleshooting custom domains
https://help.github.com/en/articles/troubleshooting-custom-domains#cname-already-taken