-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f3eb41b
Showing
25 changed files
with
890 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Sample workflow for building and deploying a Hugo site to GitHub Pages | ||
name: Deploy Hugo site to Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Set a branch to deploy | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-22.04 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true # Fetch Hugo themes (true OR recursive) | ||
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | ||
|
||
- name: Setup Hugo | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: 'latest' | ||
extended: true | ||
|
||
- name: Build | ||
run: hugo --minify | ||
|
||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: github.ref == 'refs/heads/main' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_branch: gh-pages | ||
commit_message: ${{ github.event.head_commit.message }} | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Hugo output | ||
public/ | ||
resources/ | ||
.hugo_build.lock | ||
|
||
# Editor | ||
.vscode/ | ||
|
||
# Mac | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "themes/hextra"] | ||
path = themes/hextra | ||
url = https://github.com/imfing/hextra.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
linkTitle: "文档" | ||
title: 前言 | ||
--- | ||
|
||
👋 你好!欢迎来到 Hextra 文档! | ||
|
||
<!--more--> | ||
|
||
## Hextra 是什么? | ||
|
||
Hextra 是一款现代、快速且内置丰富功能的 [Hugo][hugo] 主题,它是用 [Tailwind CSS][tailwind-css] 构建的。该主题旨在创建美观的文档、博客和网站,提供了开箱即用的功能和灵活性以满足各种需求。 | ||
|
||
## 功能特点 | ||
|
||
- **优美的设计** - 受到 Nextra 的启发,Hextra 利用 Tailwind CSS 提供了一种现代设计,使您的网站看起来出色。 | ||
- **响应式布局和深色模式** - 无论是在移动设备、平板还是桌面上,都表现出色。同时支持深色模式以适应各种光线条件。 | ||
- **快速和轻量级** - 由 Hugo 驱动,一个轻量级且超快的静态网站生成器,封装在一个单一的二进制文件中,Hextra 保持其占用极小。使用它不需要 Javascript 或 Node.js。 | ||
- **全文搜索** - 内置的离线全文搜索由 FlexSearch 提供支持,无需额外配置。 | ||
- **功能全面** - 支持 Markdown、语法高亮、LaTeX 数学公式、图表以及 Shortcodes 元素以增强您的内容。目录、面包屑、分页、侧边栏导航等都会自动生成。 | ||
- **多语言和 SEO 支持** - Hugo 的多语言模式轻松支持多语言网站。对于 SEO 标签、Open Graph 和 Twitter 卡片,也提供了开箱即用的支持。 | ||
|
||
## 有问题或反馈? | ||
|
||
{{< callout emoji="❓" >}} | ||
Hextra 仍在积极开发中。 | ||
有问题或反馈?请随时[提出问题](https://github.com/imfing/hextra/issues)! | ||
{{< /callout >}} | ||
|
||
## 接下来 | ||
|
||
直接进入以下部分开始: | ||
|
||
{{< cards >}} | ||
{{< card link="getting-started" title="入门指南" icon="document-text" subtitle="学习如何使用 Hextra 创建网站" >}} | ||
{{< /cards >}} | ||
|
||
[hugo]: https://gohugo.io/ | ||
[flex-search]: https://github.com/nextapps-de/flexsearch | ||
[tailwind-css]: https://tailwindcss.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
+++ | ||
title = '{{ replace .File.ContentBaseName "-" " " | title }}' | ||
date = {{ .Date }} | ||
draft = true | ||
+++ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
title: SHUSCT Wiki | ||
layout: hextra-home | ||
--- | ||
|
||
{{< hextra/hero-badge >}} | ||
<div class="hx-w-2 hx-h-2 hx-rounded-full hx-bg-primary-400"></div> | ||
<span>免费 开源</span> | ||
{{< icon name="arrow-circle-right" attributes="height=14" >}} | ||
{{< /hextra/hero-badge >}} | ||
|
||
<div class="hx-mt-6 hx-mb-6"> | ||
{{< hextra/hero-headline >}} | ||
创建现代化网站 <br class="sm:hx-block hx-hidden" />由 Markdown 和 Hugo 驱动 | ||
{{< /hextra/hero-headline >}} | ||
</div> | ||
|
||
<div class="hx-mb-12"> | ||
{{< hextra/hero-subtitle >}} | ||
极速且全能的 Hugo 主题框架 <br class="sm:hx-block hx-hidden" />为构建现代化的静态网站而生 | ||
{{< /hextra/hero-subtitle >}} | ||
</div> | ||
|
||
<div class="hx-mb-6"> | ||
{{< hextra/hero-button text="现在开始" link="docs" >}} | ||
</div> | ||
|
||
<div class="hx-mt-6"></div> | ||
|
||
{{< hextra/feature-grid >}} | ||
{{< hextra/feature-card | ||
title="快速且功能全面" | ||
subtitle="简单易用,功能强大丰富。" | ||
class="hx-aspect-auto md:hx-aspect-[1.1/1] max-md:hx-min-h-[340px]" | ||
imageClass="hx-top-[40%] hx-left-[24px] hx-w-[180%] sm:hx-w-[110%] dark:hx-opacity-80" | ||
style="background: radial-gradient(ellipse at 50% 80%,rgba(194,97,254,0.15),hsla(0,0%,100%,0));" | ||
>}} | ||
{{< hextra/feature-card | ||
title="Markdown 写作" | ||
subtitle="只需使用 Markdown 进行编辑。多样的 Shortcode 组件开箱即用。" | ||
class="hx-aspect-auto md:hx-aspect-[1.1/1] max-lg:hx-min-h-[340px]" | ||
imageClass="hx-top-[40%] hx-left-[36px] hx-w-[180%] sm:hx-w-[110%] dark:hx-opacity-80" | ||
style="background: radial-gradient(ellipse at 50% 80%,rgba(142,53,74,0.15),hsla(0,0%,100%,0));" | ||
>}} | ||
{{< hextra/feature-card | ||
title="全文搜索" | ||
subtitle="内置 FlexSearch 全文搜索,无需额外设置。" | ||
class="hx-aspect-auto md:hx-aspect-[1.1/1] max-md:hx-min-h-[340px]" | ||
imageClass="hx-top-[40%] hx-left-[36px] hx-w-[110%] sm:hx-w-[110%] dark:hx-opacity-80" | ||
style="background: radial-gradient(ellipse at 50% 80%,rgba(221,210,59,0.15),hsla(0,0%,100%,0));" | ||
>}} | ||
{{< hextra/feature-card | ||
title="轻如羽毛" | ||
subtitle="使用 Hextra 无需依赖 Node.js。由 Hugo 提供支持,Hugo 是最快的静态网站生成器之一,只需一个二进制文件即可在数秒内创建网站。" | ||
>}} | ||
{{< hextra/feature-card | ||
title="响应式布局,暗黑模式" | ||
subtitle="适应不同的屏幕尺寸。内置暗黑模式支持,并根据用户的系统偏好自动切换。" | ||
>}} | ||
{{< hextra/feature-card | ||
title="免费构建和托管" | ||
subtitle="使用 GitHub Actions 进行构建,并在 GitHub Pages 上免费托管。也可以托管在任何静态托管服务上。" | ||
>}} | ||
{{< hextra/feature-card | ||
title="多语言轻松实现" | ||
subtitle="仅需通过在 Markdown 文件后添加语言代码即可创建多语言页面。向您的站点添加 i18n 支持直观易行。" | ||
>}} | ||
{{< hextra/feature-card | ||
title="还有更多..." | ||
icon="sparkles" | ||
subtitle="代码高亮 / 目录 / SEO / RSS / LaTeX 公式 / Mermaid 图标 / 自定义 / 等等..." | ||
>}} | ||
{{< /hextra/feature-grid >}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: 关于 | ||
toc: false | ||
--- | ||
|
||
Hextra 是一款简洁、快速、灵活的主题,适用于构建现代化静态站点。Hextra 特别适用于文档网站,但也可用于构建博客、个人网站等各种类型的网站。 | ||
|
||
Hugo 和 Jekyll 类似,是一个静态网站生成器。但与其他生成器不同,Hugo 只有单个可执行文件,这使得它可以轻松地在各种平台上安装和运行。Hugo 的运行速度非常快且可靠性高,能够在几毫秒内渲染数千页的网站。 | ||
|
||
Hextra 被设计为轻量级,具有最小化的内存占用。使用 Hextra 无需安装繁杂的依赖,比如 Node.js;相反,你只需要一个简单的 YAML 配置文件和 Markdown 内容。因此,我们可以专注于内容而非在配置环境上浪费精力。 | ||
|
||
## 鸣谢 | ||
|
||
Hextra 的设计离不开这些项目的支持和其提供的灵感: | ||
|
||
- [Hugo](https://gohugo.io/) | ||
- [Tailwind CSS](https://tailwindcss.com/) | ||
- [Heroicons](https://heroicons.com/) | ||
- [Nextra](https://nextra.vercel.app/) | ||
- [Next.js](https://nextjs.org/) |
Binary file added
BIN
+270 KB
content/blog/Connect-to-GitHub-with-SSH-Keys/add-ssh-key-to-github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 102 additions & 0 deletions
102
content/blog/Connect-to-GitHub-with-SSH-Keys/index.zh-cn.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
--- | ||
title: "利用 SSH 密钥链接 GitHub" | ||
--- | ||
|
||
## 1. 简介 | ||
|
||
SSH 是一种网络协议, 用于计算机之间的加密登录和数据传输. 一对 SSH 密钥由一个私钥和一个公钥组成, 私钥保存在本地, 公钥保存在远程服务器上. | ||
|
||
简单来说: 你将公钥分发给全世界; 他人用你的公钥加密信息, 只有你的私钥才能解密; 你用你的私钥签名信息, 只有你的公钥才能验证. | ||
|
||
> 💬 目前有两种主流的算法生成密钥, 一种是 rsa, 另一种是 ed25519. ed25519 是一种 ECC 算法, 比起传统的 rsa 更加安全和高效. 参考资料: [Ed25519: high-speed high-security signatures](http://ed25519.cr.yp.to/) . | ||
本文使用 ed25519 算法生成密钥. | ||
|
||
**💡 重点** | ||
- 当你将一对 SSH 密钥绑定到了你的 GitHub 账号后, 你可以在任何电脑上通过私钥访问你的 GitHub 账号. | ||
- 你可以生成额外的密钥, 然后专门利用一对密钥控制一个储存库 (称为 Deploy Key). 该密钥只能访问一个储存库, 而不能访问你的账号. | ||
- SSH 连接 GitHub 通过 443 端口 (而非 22 端口). 由于在国内连接 GitHub 走 22 端口很可能被屏蔽, 因此使用 SSH 连接 GitHub 会更加稳定. | ||
|
||
|
||
## 2. 生成一对 SSH 密钥 | ||
|
||
在任意位置打开终端 (**Windows 用户请打开 Git Bash**), 通过以下命令在当前用户的个人文件夹下创建一个叫 `.ssh` 的文件夹 (如果已经创建, 终端会报错说文件夹已存在; 忽视即可): | ||
|
||
```bash | ||
mkdir ~/.ssh | ||
``` | ||
|
||
通过以下命令创建一对 SSH 密钥: | ||
|
||
```bash | ||
ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/your-key-name | ||
``` | ||
|
||
> 💡 **命令解释** | ||
> - `ssh-keygen` 表示生成 ssh 密钥 | ||
> - `-t ed25519` 表示使用 ed25519 算法; 如果使用 rsa 算法, 建议输入 `-t rsa -b 4096`, 即生成 4096 bits 的密钥 | ||
> - `-C "[email protected]"` 是对该密钥的说明, 引号内的 `[email protected]` 可以替换成任何文字; | ||
> - `-f ~/.ssh/your-key-name` 指出了密钥的生成路径以及密钥的文件名 (可以按需更改), 文件名可以依据自己的需求更改, 但是不要保留后缀名. | ||
输入命令后终端提示设置密钥的密码, 建议设置一个密码. | ||
|
||
> 📌 **注意**: 在你输入密码时, 终端的界面上不会显示出白色的输入内容字符 (看起来和没输入一样), 这是对周围环境的防范. | ||
再次输入与刚刚相同的密码, 匹配成功后提示密钥成功生成, 并输出了密钥的指纹和随机图像; 可以忽略这些内容. | ||
|
||
> 💡 **检查密钥是否成功生成**: 通过命令 `ls ~/.ssh` 可以查看路径下的所有文件; 你应该至少看到两个文件, 一个是 `your-key-name`, 另一个是 `your-key-name.pub`, 分别对应私钥和公钥. | ||
|
||
## 3. 为密钥配置 config 文件 | ||
|
||
进入路径 `~/.ssh` ; 新建一个文件, 取名为 `config` (**不要保留任何后缀名**); 在文件末尾加入以下内容 (`Identity File` 是你的密钥路径): | ||
|
||
``` | ||
Host github.com | ||
Hostname ssh.github.com | ||
Port 443 | ||
User git | ||
PreferredAuthentications publickey | ||
IdentityFile ~/.ssh/your-key-name | ||
TCPKeepAlive yes | ||
IdentitiesOnly yes | ||
``` | ||
|
||
## 4. 将公钥添加到 GitHub | ||
|
||
接着我们要在自己的 GitHub 账号中添加公钥, 这样就可以实现利用私钥访问 GitHub 账号. | ||
|
||
在你的电脑上, 复制 `~/.ssh` 路径下 `your-key-name.pub` 文件中的所有内容. | ||
|
||
根据 Fig.1: | ||
1. 打开 Github, 登录账号, 点击右上角头像; | ||
2. 点击 `Settings` 按钮进入设置页; | ||
3. 在页面左侧栏中找到 `SSH and GPG keys` , 点击进入; | ||
4. 点击右侧按钮 `New SSH key` 添加一个 ssh 公钥; | ||
5. 为公钥随便取个名字; | ||
6. 在 Key 窗口粘贴前面复制的 `your-key-name.pub` 内的内容; | ||
7. 点击按钮 `Add SSH key`. | ||
|
||
|
||
![](./add-ssh-key-to-github.png) | ||
|
||
<p align="center"> | ||
Figure 1. 如何给 GitHub 添加 SSH 公钥 | ||
</p> | ||
|
||
回到电脑, 任意位置打开终端, 输入以下命令测试和 github 的 ssh 连接: | ||
|
||
``` | ||
ssh -T [email protected] | ||
``` | ||
|
||
|
||
终端提示输入密码, 输入刚才设置的密码. | ||
|
||
**终端提示该密钥还没被授权 (Authenticate), 询问否授权; 输入 `yes` 后再回车**. | ||
|
||
接着会有类似于: `Hi jamesnulliu! You've successfully authenticated, but GitHub does not provide shell access.` 的提示. | ||
|
||
## 5. 进阶: 为某个储存库添加 Deploy Key | ||
|
||
To do ... |
Binary file added
BIN
+209 KB
content/blog/Git-Speedrun-Guide-Part-1-Basics/create-a-github-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.