github pages 搭建网站 流程

版权声明:让我们一起享受这神奇的0和1吧 https://blog.csdn.net/eebaicai/article/details/82983836

github pages 搭建网站

分两种:

  • 用户或组织网站
  • 项目网站

以用户网站为例

创建存储库

  • 转到GitHub创建一个名为username .github.io 的新存储库,其中username是您在GitHub上的用户名(或组织名称)。(如果存储库的第一部分与您的用户名不完全匹配,则无法正常工作,因此请务必正确使用。)
  • 由于username在url上是小写,所以仓库名也要小写

克隆存储库

  • 转到要存储项目的文件夹,然后克隆新存储库:
  • git clone https://github.com/ *用户名* / *用户名* .github.io

你好,世界

  • 输入项目文件夹并添加index.html文件:echo“Hello World”> index.html

push it

  • 添加,提交和推送您的更改:
  • git add --all / git add .
  • git commit -m“初始提交”
  • git push -u origin master

完成

Unpublishing a User Pages site

You can unpublish your GitHub User Pages site if the content is no longer relevant or you no longer want it to be publicly available.

  1. To unpublish your User Pages site, delete either the master branch in your<username>.github.io repository, or the entire <username>.github.io repository. For more information, see “Deleting unused branches” or “Deleting a repository.”
  2. If there is a custom domain enabled for the site, update your DNS settings. For more information, see “Using a custom domain with GitHub Pages.”

以项目网站为例:

  • 自动生成器生成网站(选择一个主题)

    存储库设置

    • 前往GitHub.com并创建一个新的存储库,或转到现有存储库。
      单击“设置”选项卡

    主题选择器

    • 向下滚动到GitHub页面部分。按选择主题

    选择一个主题

    • 从顶部的旋转木马中选择一个主题。
      完成后,单击右侧的“ 选择主题 ”。

    编辑内容

    • 使用编辑器向您的网站添加内容。

    提交

    • 输入提交注释,然后单击编辑器下方的Commit changes

    完成

  • 自己手写(白手起家)

    创建索引文件

    你好,世界

    • 命名文件index.html并在编辑器中键入一些HTML内容。

    提交文件

    • 滚动到页面底部,编写提交消息,然后提交新文件。

    存储库设置

    • 单击“设置”选项卡,然后向下滚动到“GitHub页面”部分。
      然后选择
      主分支
      源并单击“ **保存”**按钮。

    完成

可以结合Jekyll使用,您可以使用漂亮的Markdown语法进行博客,而无需处理任何数据库。

自定义域名:https://help.github.com/articles/using-a-custom-domain-with-github-pages/


猜你喜欢

转载自blog.csdn.net/eebaicai/article/details/82983836