创建本身的github.io

[复制链接]
发表于 2025-10-10 18:43:05 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
1、创建GitHub账号
  1. GitHub地址:https://github.com/
  2. 点击Sign up创建账号
  3. 如果已创建,点击Sign in登录
复制代码
2、创建堆栈
  1. 假设Owner为username,则Repository name为username.github.io
  2. 说明:
  3. 1、Owner为用户名
  4. 2、Repository name为仓库名,格式为:用户名.github.io
复制代码





3、设置SSH-Key

3.1、天生SSH密钥
  1. ssh-keygen -t rsa -f ~/.ssh/github_id_rsa
复制代码
3.2、查察SSH公钥
  1. cat ~/.ssh/github_id_rsa.pub
复制代码
3.3、摆设公钥
  1. 详见:
  2. https://gitee.com/help/articles/4181#article-header0
  3. https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
复制代码
4、克隆项目
  1. git clone [email protected]:username/username.github.io.git
复制代码
5、创建文件
  1. cd username.github.io
  2. echo "Hello World" > index.html
复制代码
6、提交文件
  1. git add .
  2. git commit -m "Initial commit"
  3. git push -u origin main
复制代码
7、欣赏器访问
  1. 浏览器访问域名:username.github.io
复制代码
8、设置CNAME
  1. 如果不想配置CNAME,忽略以下操作。
复制代码
8.1、以阿里云域名为例,设置CNAME



8.2、给GitHub的username.github.io堆栈设置自界说域名



8.3、查察GitHub的username.github.io堆栈
  1. 发现仓库多了一个文件,文件名为CNAME,文件内容为自定义的域名
复制代码
8.4、欣赏器访问
  1. 1、访问自定义域名username.xxx.yyy
  2. 2、访问username.github.io会跳转到username.xxx.yyy
复制代码
9、详见
  1. https://pages.github.com/
  2. https://docs.github.com/zh/pages
复制代码
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表