创建自己的github.io

1、创建GitHub账号

bash 复制代码
GitHub地址:https://github.com/
点击Sign up创建账号
如果已创建,点击Sign in登录

2、创建仓库

bash 复制代码
假设Owner为username,则Repository name为username.github.io

说明:
1、Owner为用户名
2、Repository name为仓库名,格式为:用户名.github.io

3、配置SSH-Key

3.1、生成SSH密钥

bash 复制代码
ssh-keygen -t rsa -f ~/.ssh/github_id_rsa

3.2、查看SSH公钥

bash 复制代码
cat ~/.ssh/github_id_rsa.pub

3.3、部署公钥

bash 复制代码
详见:
https://gitee.com/help/articles/4181#article-header0
https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

4、克隆项目

bash 复制代码
git clone [email protected]:username/username.github.io.git

5、创建文件

bash 复制代码
cd username.github.io
echo "Hello World" > index.html

6、提交文件

bash 复制代码
git add .
git commit -m "Initial commit"
git push -u origin main

7、浏览器访问

bash 复制代码
浏览器访问域名:username.github.io

8、配置CNAME

bash 复制代码
如果不想配置CNAME,忽略以下操作。

8.1、以阿里云域名为例,配置CNAME

8.2、给GitHub的username.github.io仓库配置自定义域名

8.3、查看GitHub的username.github.io仓库

bash 复制代码
发现仓库多了一个文件,文件名为CNAME,文件内容为自定义的域名

8.4、浏览器访问

bash 复制代码
1、访问自定义域名username.xxx.yyy
2、访问username.github.io会跳转到username.xxx.yyy

9、详见

bash 复制代码
https://pages.github.com/
https://docs.github.com/zh/pages
相关推荐
油泼辣子多加16 分钟前
2025年05月30日Github流行趋势
github
小和尚同志37 分钟前
3. Github Actions 自动部署
程序员·开源·github
漫步者TZ3 小时前
【Netty系列】Reactor 模式 1
java·开发语言·github
粥里有勺糖4 小时前
视野修炼-技术周刊第121期 | Rolldown-Vite
前端·javascript·github
寻月隐君9 小时前
从零到 Web3:使用 @solana/kit 快速查询 Solana 账户余额
后端·web3·github
AI码农9 小时前
极限3天:微信小程序实时语音对话 SDK 开发实战(基于 Coze API)
javascript·github
梓羽玩Python11 小时前
这款开源神器把Excel翻译卷出新高度!免费、无限文件大小、公式精准!
github
uhakadotcom12 小时前
王者荣耀排位算法:Elo 排名算法简介
算法·面试·github
我是哪吒13 小时前
分布式微服务系统架构第143集:pom文件
后端·面试·github
xbd_zc14 小时前
【Github/Gitee Webhook触发自动部署-Jenkins】
运维·gitee·自动化·github·jenkins