<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <author>
    <name>ZhengXi</name>
  </author>
  <generator uri="https://hexo.io/">Hexo</generator>
  <id>https://blog.zhengxi.me/</id>
  <link href="https://blog.zhengxi.me/" rel="alternate"/>
  <link href="https://blog.zhengxi.me/atom.xml" rel="self"/>
  <rights>All rights reserved 2026, ZhengXi</rights>
  <subtitle>一菇一世界，一伞一春秋</subtitle>
  <title>伞间岁月</title>
  <updated>2026-04-26T06:48:41.000Z</updated>
  <entry>
    <author>
      <name>ZhengXi</name>
    </author>
    <category term="开发笔记" scheme="https://blog.zhengxi.me/categories/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0/"/>
    <category term="Hexo" scheme="https://blog.zhengxi.me/tags/Hexo/"/>
    <category term="GitHub Pages" scheme="https://blog.zhengxi.me/tags/GitHub-Pages/"/>
    <category term="GitHub Actions" scheme="https://blog.zhengxi.me/tags/GitHub-Actions/"/>
    <category term="静态博客" scheme="https://blog.zhengxi.me/tags/%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2/"/>
    <category term="CI/CD" scheme="https://blog.zhengxi.me/tags/CI-CD/"/>
    <category term="Node.js" scheme="https://blog.zhengxi.me/tags/Node-js/"/>
    <content>
      <![CDATA[<blockquote><p><strong>适用环境</strong>：macOS / Windows / Linux + Node.js 16.0+ + Git<br /><strong>目标</strong>：在 GitHub Pages 上搭建 Hexo 静态博客，实现「写文章 → 推送源码 → 自动构建并部署」的全自动化工作流</p></blockquote><hr /><h2 id="概述"><a class="markdownIt-Anchor" href="#概述"></a> 概述</h2><p>静态博客方案结合了 Markdown 的写作体验和 GitHub Pages 的免费托管能力，是个人技术博客和知识库的首选方案之一。Hexo 作为最流行的静态博客框架，生态成熟、主题丰富、部署方式灵活，社区中积累了大量开箱即用的主题和插件。</p><p>本文以一个真实的生产环境博客（<a href="https://blog.realzhengxi.com">伞间岁月</a>）为案例，详细讲解：</p><ul><li>Hexo 项目的初始化和核心配置</li><li>主题选择与定制要点</li><li>GitHub Actions 自动化部署流水线的完整搭建</li><li>自定义域名与 CDN 加速</li><li>日常写作工作流和问题排查</li></ul><hr /><h2 id="一-整体架构"><a class="markdownIt-Anchor" href="#一-整体架构"></a> 一、整体架构</h2><p>静态博客方案的核心思想是 <strong>源码与静态文件分离</strong>：源码仓库存放 Hexo 源文件（Markdown 文章、主题、配置），GitHub Pages 仓库只存放构建后的 HTML/CSS/JS。两者通过 GitHub Actions 自动同步。</p><pre><code>                    Hexo 源码仓库            github.com/你的用户名/blog-source  _posts/        themes/        _config.yml     .github/  文章.md        主题文件         package         workflows/                                .json           deploy.yml                      │ git push (main 分支)                      ▼                    GitHub Actions  1. actions/checkout@v3 → 拉取源码  2. 安装 Node.js + npm ci  3. hexo generate → 构建静态文件  4. 推送 public/ 到 Pages 仓库的 gh-pages 分支                      │ 自动部署                      ▼                   GitHub Pages 仓库        github.com/你的用户名/你的用户名.github.io  gh-pages 分支：index.html, archives/, posts/, ...                      │ GitHub Pages 服务                      ▼                    https://你的域名/</code></pre><p>这种架构的优势：</p><ul><li><strong>职责清晰</strong>：源文件和构建产物互不干扰</li><li><strong>安全可控</strong>：源码仓库可设为 Private，Pages 仓库保持 Public</li><li><strong>零成本运维</strong>：GitHub Pages + Actions 的免费额度对个人博客绰绰有余</li><li><strong>全自动化</strong>：一次配置，永久生效，只管写作和推送</li></ul><hr /><h2 id="二-前置准备"><a class="markdownIt-Anchor" href="#二-前置准备"></a> 二、前置准备</h2><h3 id="21-安装-nodejs"><a class="markdownIt-Anchor" href="#21-安装-nodejs"></a> 2.1 安装 Node.js</h3><p>Hexo 基于 Node.js，首先确保系统已安装 Node.js 16.0+：</p><pre><code class="bash"># macOSbrew install node# Windows（推荐使用 nvm-windows 或直接下载安装包）# https://nodejs.org/# Linuxcurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -sudo apt-get install -y nodejs# 验证版本node -vnpm -v</code></pre><h3 id="22-安装-git-并配置-ssh"><a class="markdownIt-Anchor" href="#22-安装-git-并配置-ssh"></a> 2.2 安装 Git 并配置 SSH</h3><pre><code class="bash"># macOSbrew install git# Windows: https://git-scm.com/download/win# Linux: sudo apt-get install git# 配置全局身份信息git config --global user.name &quot;你的 GitHub 用户名&quot;git config --global user.email &quot;你的邮箱@example.com&quot;# 生成 SSH 密钥对ssh-keygen -t ed25519 -C &quot;你的邮箱@example.com&quot;# 查看并复制公钥cat ~/.ssh/id_ed25519.pub</code></pre><p>将输出的公钥添加到 GitHub → <strong>Settings</strong> → <strong>SSH and GPG keys</strong> → <strong>New SSH key</strong>。</p><blockquote><p>SSH 的详细配置（包括多账号、权限问题排查）可参考同系列的 <a href="https://blog.realzhengxi.com/posts/3792786316/">《微信小程序 Git 远程仓库设置》</a>。</p></blockquote><h3 id="23-创建两个-github-仓库"><a class="markdownIt-Anchor" href="#23-创建两个-github-仓库"></a> 2.3 创建两个 GitHub 仓库</h3><p>需要准备两个仓库：</p><table><thead><tr><th>仓库</th><th>作用</th><th>建议可见性</th></tr></thead><tbody><tr><td><code>blog-source</code></td><td>存放 Hexo 源码（包括文章、主题、配置）</td><td>Private（可选）</td></tr><tr><td><code>你的用户名.github.io</code> 或 <code>blog</code></td><td>存放构建后的静态文件</td><td>Public（必须）</td></tr></tbody></table><blockquote><p><strong>命名说明</strong>：如果你的站点是用户级 Pages（<code>https://你的用户名.github.io</code>），Pages 仓库必须命名为 <code>你的用户名.github.io</code>。如果是项目级 Pages（<code>https://你的用户名.github.io/仓库名/</code>），仓库名可以任意。</p></blockquote><hr /><h2 id="三-初始化-hexo-项目"><a class="markdownIt-Anchor" href="#三-初始化-hexo-项目"></a> 三、初始化 Hexo 项目</h2><h3 id="31-安装-hexo-cli"><a class="markdownIt-Anchor" href="#31-安装-hexo-cli"></a> 3.1 安装 Hexo CLI</h3><pre><code class="bash">npm install -g hexo-cli</code></pre><h3 id="32-创建项目"><a class="markdownIt-Anchor" href="#32-创建项目"></a> 3.2 创建项目</h3><pre><code class="bash"># 在目标目录创建 Hexo 项目hexo init blog-sourcecd blog-source# 安装项目依赖npm install</code></pre><p><code>hexo init</code> 生成的目录结构：</p><pre><code>blog-source/├── _config.yml        # 站点配置文件——最重要的配置文件├── package.json       # Node.js 依赖声明├── node_modules/      # 依赖包（不提交到 Git）├── scaffolds/         # 文章模板（可自定义）├── source/            # 源文件目录│   ├── _posts/        # 博客文章（Markdown 文件）│   └── CNAME          # 自定义域名文件（可选）├── themes/            # 主题目录└── public/            # 构建输出（自动生成，不提交）</code></pre><h3 id="33-安装常用插件"><a class="markdownIt-Anchor" href="#33-安装常用插件"></a> 3.3 安装常用插件</h3><pre><code class="bash">npm install hexo-abbrlink hexo-generator-feed --save</code></pre><p>各插件作用：</p><table><thead><tr><th>插件</th><th>作用</th></tr></thead><tbody><tr><td><code>hexo-abbrlink</code></td><td>为每篇文章生成唯一数字短链接（如 <code>/posts/3789650242/</code>），避免中文标题 URL 编码问题</td></tr><tr><td><code>hexo-generator-feed</code></td><td>生成 RSS/Atom 订阅源，方便读者订阅更新</td></tr><tr><td><code>hexo-deployer-git</code></td><td>本地 <code>hexo deploy</code> 命令的支持（可选，使用 GitHub Actions 时可省略）</td></tr></tbody></table><hr /><h2 id="四-站点配置"><a class="markdownIt-Anchor" href="#四-站点配置"></a> 四、站点配置</h2><h3 id="41-编辑-_configyml"><a class="markdownIt-Anchor" href="#41-编辑-_configyml"></a> 4.1 编辑 _config.yml</h3><p>项目根目录的 <code>_config.yml</code> 是 Hexo 的核心配置文件。以下是关键配置项：</p><pre><code class="yaml"># ===== 站点信息 =====title: 我的博客subtitle: '副标题'description: '博客描述，用于 SEO'author: 你的名字language: zh-CNtimezone: ''# ===== URL 配置 =====url: https://你的域名.com                         # 博客最终访问地址permalink: posts/:abbrlink/                       # 使用 abbrlink 短链接permalink_defaults:pretty_urls:  trailing_index: false                           # 去除 index.html# ===== 目录配置 =====source_dir: sourcepublic_dir: publictag_dir: tagsarchive_dir: archivescategory_dir: categories# ===== 写作配置 =====syntax_highlighter: false       # 关闭内置高亮（交给主题处理）highlight:  enable: falseprismjs:  enable: false# ===== 首页分页 =====index_generator:  per_page: 10  order_by: -date# ===== 文章短链接（hexo-abbrlink）=====abbrlink:  alg: crc32                    # 算法：crc16（更短）或 crc32（更唯一）  reps: true                    # 使用数字 + 字母混合# ===== RSS Feed =====feed:  type: atom  path: atom.xml  limit: 20  order_by: -date</code></pre><h3 id="42-初始化-git-并推送到远程"><a class="markdownIt-Anchor" href="#42-初始化-git-并推送到远程"></a> 4.2 初始化 Git 并推送到远程</h3><pre><code class="bash">git initgit add .git commit -m &quot;feat: init hexo blog&quot;git remote add origin git@github.com:你的用户名/blog-source.gitgit branch -M maingit push -u origin main</code></pre><hr /><h2 id="五-主题配置"><a class="markdownIt-Anchor" href="#五-主题配置"></a> 五、主题配置</h2><h3 id="51-选择主题"><a class="markdownIt-Anchor" href="#51-选择主题"></a> 5.1 选择主题</h3><p>Hexo 拥有丰富的主题生态，可通过 <a href="https://hexo.io/themes/">Hexo Themes 官方列表</a> 浏览。以下是社区中活跃度较高的主题：</p><table><thead><tr><th>主题</th><th>GitHub Stars</th><th>特点</th></tr></thead><tbody><tr><td><strong>Butterfly</strong></td><td>7k+</td><td>功能全面，文档完善，支持卡片布局和图片画廊</td></tr><tr><td><strong>Keep</strong></td><td>1k+</td><td>简洁现代，性能优化好，支持 PJAX 无刷新跳转</td></tr><tr><td><strong>NexT</strong></td><td>10k+</td><td>经典主题，生态丰富，插件体系完善</td></tr><tr><td><strong>Fluid</strong></td><td>2k+</td><td>Material Design 风格，适配移动端优秀</td></tr></tbody></table><h3 id="52-安装主题"><a class="markdownIt-Anchor" href="#52-安装主题"></a> 5.2 安装主题</h3><p>以 Keep 主题为例：</p><pre><code class="bash">git clone https://github.com/theme-keep/hexo-theme-keep.git themes/keep</code></pre><p>在 <code>_config.yml</code> 中启用：</p><pre><code class="yaml">theme: keep</code></pre><h3 id="53-主题配置方式重要"><a class="markdownIt-Anchor" href="#53-主题配置方式重要"></a> 5.3 主题配置方式（重要）</h3><p>每个主题都有自己的配置项，有两种配置方式：</p><p><strong>方式一（推荐）</strong>：在项目根目录创建 <code>_config.&#123;主题名&#125;.yml</code>，Hexo 会自动合并此文件的内容到主题默认配置之上。这样做的好处是避免直接修改 <code>themes/</code> 目录下的文件，方便以后升级主题。</p><pre><code class="yaml"># _config.keep.ymlmenu:  首页: /  归档: /archives/  分类: /categories/  标签: /tags/favicon: /images/favicon.pngavatar: /images/avatar.jpgsocial:  GitHub: https://github.com/你的用户名</code></pre><p><strong>方式二</strong>：直接编辑 <code>themes/keep/_config.yml</code>（不推荐，升级主题时会覆盖）。</p><blockquote><p><strong>主题渲染器依赖</strong>：部分主题需要额外的渲染器。Keep 主题需要 <code>hexo-renderer-ejs</code> 和 <code>hexo-renderer-stylus</code>，Butterfly 需要 <code>hexo-renderer-pug</code>。安装主题时请阅读其文档确认。</p></blockquote><hr /><h2 id="六-github-actions-自动化部署"><a class="markdownIt-Anchor" href="#六-github-actions-自动化部署"></a> 六、GitHub Actions 自动化部署</h2><p>这是本方案的核心环节。配置完成后，你只需要 <code>git push</code> 源码，博客便会自动构建并部署。</p><h3 id="61-部署流程概览"><a class="markdownIt-Anchor" href="#61-部署流程概览"></a> 6.1 部署流程概览</h3><pre><code class="bash">你写文章 → git push → GitHub Actions 触发 →  → Checkout 源码 → 安装依赖 → hexo generate →  → 推送 public/ 到 Pages 仓库 → GitHub Pages 生效</code></pre><h3 id="62-创建-github-personal-access-token"><a class="markdownIt-Anchor" href="#62-创建-github-personal-access-token"></a> 6.2 创建 GitHub Personal Access Token</h3><p>GitHub Actions 需要权限将构建产物推送到 Pages 仓库：</p><ol><li>打开 GitHub → 右上角头像 → <strong>Settings</strong> → <strong>Developer settings</strong> → <strong>Personal access tokens</strong> → <strong>Tokens (classic)</strong></li><li>点击 <strong>Generate new token (classic)</strong></li><li><strong>Note</strong>：填写 <code>HEXO_DEPLOY</code>（方便识别）</li><li><strong>Expiration</strong>：选择 <code>No expiration</code>（永不过期），或选择 90 天并在过期前刷新</li><li><strong>Scopes</strong>：勾选 <code>repo</code>（Full control of private repositories）——这包含了将文件推送到仓库所需的所有权限</li><li>点击底部的 <strong>Generate token</strong></li><li><strong>立即复制并保存生成的 Token</strong>（关闭页面后将无法再次查看）</li></ol><h3 id="63-将-token-添加到源码仓库-secrets"><a class="markdownIt-Anchor" href="#63-将-token-添加到源码仓库-secrets"></a> 6.3 将 Token 添加到源码仓库 Secrets</h3><ol><li>打开你的<strong>源码仓库</strong> → <strong>Settings</strong> → <strong>Secrets and variables</strong> → <strong>Actions</strong></li><li>点击 <strong>New repository secret</strong></li><li><strong>Name</strong>：<code>HEXO_DEPLOY</code>（必须与 workflow 文件中引用的名称一致）</li><li><strong>Secret</strong>：粘贴上一步保存的 Token</li><li>点击 <strong>Add secret</strong></li></ol><h3 id="64-创建-workflow-文件"><a class="markdownIt-Anchor" href="#64-创建-workflow-文件"></a> 6.4 创建 Workflow 文件</h3><p>在项目根目录创建 <code>.github/workflows/hexo-deploy.yml</code>：</p><pre><code class="yaml">name: deploying Hexo project to GitHub pageson:  push:    branches:      - main  # 当 main 分支有推送时触发jobs:  build-and-deploy:    runs-on: ubuntu-latest    steps:      - name: Checkout        uses: actions/checkout@v3        with:          fetch-depth: 0      - name: Build and Deploy        uses: theme-keep/hexo-deploy-github-pages-action@master        env:          PERSONAL_TOKEN: $&#123;&#123; secrets.HEXO_DEPLOY &#125;&#125;          PUBLISH_REPOSITORY: 你的用户名/你的Pages仓库名          BRANCH: gh-pages          PUBLISH_DIR: ./public</code></pre><p><strong>关键配置项说明</strong>：</p><table><thead><tr><th>参数</th><th>含义</th><th>示例</th></tr></thead><tbody><tr><td><code>PERSONAL_TOKEN</code></td><td>GitHub Token（通过 Secrets 引用）</td><td><code>$&#123;&#123; secrets.HEXO_DEPLOY &#125;&#125;</code></td></tr><tr><td><code>PUBLISH_REPOSITORY</code></td><td>Pages 仓库位置</td><td><code>realzhengxi/zhengxi_blog</code></td></tr><tr><td><code>BRANCH</code></td><td>部署分支，固定为 <code>gh-pages</code></td><td><code>gh-pages</code></td></tr><tr><td><code>PUBLISH_DIR</code></td><td>Hexo 构建产物目录</td><td><code>./public</code></td></tr></tbody></table><p>这个 Action 会自动完成以下步骤：</p><ol><li>拉取源码仓库的最新代码</li><li>安装 Node.js（内置使用 Node 18）</li><li>执行 <code>npm ci</code> 安装依赖（比 <code>npm install</code> 更快，且保证依赖版本锁定）</li><li>执行 <code>npx hexo generate</code> 构建静态文件</li><li>将 <code>public/</code> 目录下的所有文件推送到 Pages 仓库的 <code>gh-pages</code> 分支</li><li><code>gh-pages</code> 分支的历史会被覆盖（保持只存最新版本）</li></ol><h3 id="65-提交并推送"><a class="markdownIt-Anchor" href="#65-提交并推送"></a> 6.5 提交并推送</h3><pre><code class="bash">git add .github/git commit -m &quot;ci: add GitHub Actions deploy workflow&quot;git push origin main</code></pre><p>推送后，打开源码仓库的 <strong>Actions</strong> 标签页，可以看到工作流正在执行。等待黄色的运行中图标变为绿色勾号，说明部署成功。</p><hr /><h2 id="七-配置-github-pages"><a class="markdownIt-Anchor" href="#七-配置-github-pages"></a> 七、配置 GitHub Pages</h2><h3 id="71-启用-pages-服务"><a class="markdownIt-Anchor" href="#71-启用-pages-服务"></a> 7.1 启用 Pages 服务</h3><ol><li>打开 Pages 仓库 → <strong>Settings</strong> → <strong>Pages</strong></li><li><strong>Source</strong> 选择 <strong>Deploy from a branch</strong></li><li><strong>Branch</strong> 选择 <code>gh-pages</code>，目录选 <code>/ (root)</code></li><li>点击 <strong>Save</strong></li></ol><p>配置完成后，博客即可通过 <code>https://你的用户名.github.io/你的Pages仓库名/</code> 访问。</p><h3 id="72-配置自定义域名"><a class="markdownIt-Anchor" href="#72-配置自定义域名"></a> 7.2 配置自定义域名</h3><p>绑定自己的域名可以让博客更专业。以下以 <code>blog.example.com</code> 为例：</p><p><strong>第一步</strong>：在域名 DNS 管理后台添加解析记录</p><table><thead><tr><th>记录类型</th><th>主机记录</th><th>记录值</th></tr></thead><tbody><tr><td>CNAME</td><td><code>blog</code></td><td><code>你的用户名.github.io</code></td></tr></tbody></table><p><strong>第二步</strong>：在 Pages 仓库设置域名</p><p>在 Pages 仓库的 <strong>Settings</strong> → <strong>Pages</strong> → <strong>Custom domain</strong> 中输入 <code>blog.example.com</code>，点击 <strong>Save</strong>。GitHub 会自动签发 SSL/TLS 证书。</p><p><strong>第三步</strong>：在源码仓库添加 CNAME 文件</p><p>在 <code>source/</code> 目录下创建 <code>CNAME</code> 文件（无扩展名），内容为你的域名：</p><pre><code>blog.example.com</code></pre><blockquote><p><strong>为什么 CNAME 文件要放在 <code>source/</code> 目录？</strong> 因为 <code>hexo generate</code> 时，<code>source/</code> 下的所有文件（不含 <code>_posts/</code> 中的文章）会原样复制到 <code>public/</code>，确保每次构建后 CNAME 文件都在部署目录中。</p></blockquote><hr /><h2 id="八-日常写作工作流"><a class="markdownIt-Anchor" href="#八-日常写作工作流"></a> 八、日常写作工作流</h2><p>所有配置完成后，日常使用就变得非常简单：</p><pre><code class="bash"># 1. 创建新文章hexo new post &quot;新文章标题&quot;# 2. 用任何编辑器编辑 Markdown 文件#    文件位置：source/_posts/新文章标题.mdcode source/_posts/新文章标题.md# 3. 本地预览（可选，但推荐）hexo clean &amp;&amp; hexo generate &amp;&amp; hexo server# 浏览器访问 http://localhost:4000# 4. 提交并推送git add source/_posts/git commit -m &quot;post: add 新文章标题&quot;git push</code></pre><p>推送后等待 1-2 分钟，GitHub Actions 构建部署完成，博客即自动更新。</p><hr /><h2 id="九-最佳实践与注意事项"><a class="markdownIt-Anchor" href="#九-最佳实践与注意事项"></a> 九、最佳实践与注意事项</h2><h3 id="91-gitignore-配置"><a class="markdownIt-Anchor" href="#91-gitignore-配置"></a> 9.1 .gitignore 配置</h3><pre><code>node_modules/public/.deploy_git/db.json*.log.DS_Store</code></pre><p>确保 <code>node_modules/</code> 和 <code>public/</code> 不提交到 Git 仓库。</p><h3 id="92-借助-cdn-加速静态资源"><a class="markdownIt-Anchor" href="#92-借助-cdn-加速静态资源"></a> 9.2 借助 CDN 加速静态资源</h3><p>国内访问 GitHub Pages 速度较慢，可以使用 jsDelivr CDN 对主题的静态资源进行加速。</p><p>以本博客的配置为例，在 <code>_config.yml</code> 中添加 CDN 配置：</p><pre><code class="yaml">cdn:  enable: true  url: 'https://cdn.jsdelivr.net/gh/你的用户名/你的源码仓库@main/source'  vendors:    highlight_js: 'https://cdn.jsdelivr.net/npm/highlight.js@11.10.0'    highlight_css: 'https://cdn.jsdelivr.net/npm/highlight.js@11.10.0/styles/atom-one-dark.min.css'</code></pre><p>jsDelivr 的 GitHub 加速格式：<code>https://cdn.jsdelivr.net/gh/&#123;用户名&#125;/&#123;仓库&#125;@&#123;分支&#125;/&#123;文件路径&#125;</code>，完全免费，无需注册。</p><h3 id="93-为文章添加封面图"><a class="markdownIt-Anchor" href="#93-为文章添加封面图"></a> 9.3 为文章添加封面图</h3><p>在文章 YAML 头部添加 <code>cover</code> 字段可以设置封面图，在首页和文章列表中以卡片形式展示。推荐使用图床存储图片，避免图片文件占用源码仓库空间。</p><pre><code class="yaml">---title: 文章标题cover: https://图床域名/path/to/cover.jpg---</code></pre><h3 id="94-插件推荐"><a class="markdownIt-Anchor" href="#94-插件推荐"></a> 9.4 插件推荐</h3><table><thead><tr><th>插件</th><th>作用</th></tr></thead><tbody><tr><td><code>hexo-abbrlink</code></td><td>生成短链接，避免中文 URL</td></tr><tr><td><code>hexo-generator-feed</code></td><td>RSS 订阅</td></tr><tr><td><code>hexo-generator-searchdb</code></td><td>本地搜索索引</td></tr><tr><td><code>hexo-wordcount</code></td><td>文章字数统计</td></tr><tr><td><code>hexo-filter-titlebased-link</code></td><td>Obsidian 风格的 <code>[[双链]]</code> 支持</td></tr></tbody></table><h3 id="95-常见问题排查"><a class="markdownIt-Anchor" href="#95-常见问题排查"></a> 9.5 常见问题排查</h3><p><strong>Q1：GitHub Actions 构建失败</strong></p><pre><code class="bash"># 查看 Actions 日志中的具体错误</code></pre><p>常见原因：</p><ul><li><code>HEXO_DEPLOY</code> Secret 未配置或 Token 已过期 → 检查 Secrets 设置</li><li><code>PUBLISH_REPOSITORY</code> 格式错误 → 必须为 <code>用户名/仓库名</code></li><li>Token 缺少 <code>repo</code> 权限 → 重新生成 Token 时确认勾选 <code>repo</code></li></ul><p><strong>Q2：博客更新但页面未变化</strong></p><ol><li>GitHub Pages 部署通常有 1-2 分钟延迟</li><li>尝试强制刷新浏览器（<code>Cmd+Shift+R</code> / <code>Ctrl+F5</code>）</li><li>确认 GitHub Actions 工作流运行成功（绿色勾号）</li></ol><p><strong>Q3：自定义域名 SSL 证书未生效</strong></p><ul><li>GitHub Pages 的 SSL 证书通过 Let’s Encrypt 自动签发，首次配置可能需要等待 5-15 分钟</li><li>确认 DNS 的 CNAME 记录已正确指向 <code>你的用户名.github.io</code></li><li>可以在 Pages 设置页面取消绑定再重新绑定，触发证书重新签发</li></ul><p><strong>Q4：图片加载失败</strong></p><ul><li>确认图片 URL 可公开访问</li><li>使用图床（如 <a href="http://SM.MS">SM.MS</a>、Cloudflare R2、阿里云 OSS）存储图片</li><li>或使用 jsDelivr 加速 GitHub 仓库中的图片：<code>https://cdn.jsdelivr.net/gh/用户名/仓库@分支/图片路径</code></li></ul><hr /><h2 id="参考资料"><a class="markdownIt-Anchor" href="#参考资料"></a> 参考资料</h2><ul><li><a href="https://hexo.io/docs/">Hexo 官方文档</a></li><li><a href="https://docs.github.com/en/pages">GitHub Pages 官方文档</a></li><li><a href="https://docs.github.com/en/actions">GitHub Actions 官方文档</a></li><li><a href="https://github.com/marketplace/actions/hexo-deploy-github-pages-action">hexo-deploy-github-pages-action</a></li><li><a href="https://github.com/rozbo/hexo-abbrlink">hexo-abbrlink 插件</a></li><li><a href="https://keep-doc.xaox.cc/">Keep 主题文档</a></li><li><a href="https://butterfly.js.org/">Butterfly 主题文档</a></li><li><a href="https://www.jsdelivr.com/">jsDelivr CDN 文档</a></li><li><a href="https://github.com/realzhengxi/zhengxi_blog_source/blob/main/.github/workflows/hexo-deploy.yml">本博客 GitHub Actions 工作流源码</a></li></ul>]]>
    </content>
    <id>https://blog.zhengxi.me/posts/3789650242/</id>
    <link href="https://blog.zhengxi.me/posts/3789650242/"/>
    <published>2026-04-26T00:00:00.000Z</published>
    <summary>从零搭建 Hexo 静态博客，通过 GitHub Actions 实现源码推送即自动部署。以真实生产环境为案例，涵盖项目架构、主题配置、CI/CD 流水线和自定义域名。</summary>
    <title>Hexo 静态博客方案 ｜ GitHub Actions 自动化部署</title>
    <updated>2026-04-26T06:48:41.000Z</updated>
  </entry>
  <entry>
    <author>
      <name>ZhengXi</name>
    </author>
    <category term="开发笔记" scheme="https://blog.zhengxi.me/categories/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0/"/>
    <category term="Claude Code" scheme="https://blog.zhengxi.me/tags/Claude-Code/"/>
    <category term="DeepSeek" scheme="https://blog.zhengxi.me/tags/DeepSeek/"/>
    <category term="Kimi" scheme="https://blog.zhengxi.me/tags/Kimi/"/>
    <category term="macOS" scheme="https://blog.zhengxi.me/tags/macOS/"/>
    <category term="开发工具" scheme="https://blog.zhengxi.me/tags/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/"/>
    <category term="AI编程" scheme="https://blog.zhengxi.me/tags/AI%E7%BC%96%E7%A8%8B/"/>
    <content>
      <![CDATA[<blockquote><p><strong>适用环境</strong>：macOS（Intel / Apple Silicon）+ Homebrew + zsh<br /><strong>目标</strong>：在无法直接访问 Anthropic 官方服务的环境下，让 Claude Code 通过国内大模型（DeepSeek、Kimi、GLM、MiniMax 等）正常运行。</p></blockquote><hr /><h2 id="一-安装-claude-code"><a class="markdownIt-Anchor" href="#一-安装-claude-code"></a> 一、安装 Claude Code</h2><p>Claude Code 是 Anthropic 推出的终端 AI 编程助手，可通过 Homebrew 一键安装：</p><pre><code class="bash">brew install --cask claude-code@latest</code></pre><p>安装完成后，终端输入：</p><pre><code class="bash">claude</code></pre><p>如果看到 Claude Code 的 ASCII 艺术启动画面，说明安装成功。</p><hr /><h2 id="二-国内网络环境下的核心问题"><a class="markdownIt-Anchor" href="#二-国内网络环境下的核心问题"></a> 二、国内网络环境下的核心问题</h2><p>安装完成后，直接运行 <code>claude</code> 大概率会报错：</p><pre><code>Unable to connect to Anthropic servicesFailed to connect to api.anthropic.com: ERR_BAD_REQUEST</code></pre><p><strong>原因</strong>：Claude Code 默认直连 Anthropic 官方 API（<code>api.anthropic.com</code>），而国内网络环境无法稳定访问该地址。</p><p><strong>解决思路</strong>：Claude Code 底层调用的是 Anthropic Messages API。国内大模型厂商（DeepSeek、Kimi、GLM、MiniMax 等）已经提供了<strong>兼容该协议的接口</strong>。我们只需修改几个环境变量，让 Claude Code 把请求转发到国内模型即可。</p><hr /><h2 id="三-方案探索ccswitch-工具及踩坑记录"><a class="markdownIt-Anchor" href="#三-方案探索ccswitch-工具及踩坑记录"></a> 三、方案探索：ccswitch 工具（及踩坑记录）</h2><p>社区有一个专门用于 Claude Code 模型切换的开源工具 <code>claude-code-switch</code>（简称 ccswitch），理论上可以一键切换模型。</p><h3 id="31-尝试安装-ccswitch"><a class="markdownIt-Anchor" href="#31-尝试安装-ccswitch"></a> 3.1 尝试安装 ccswitch</h3><pre><code class="bash">npm install -g claude-code-switch</code></pre><p><strong>踩坑 1：权限报错（EACCES）</strong></p><pre><code>npm error code EACCESnpm error syscall symlinknpm error path ../lib/node_modules/claude-code-switch/bin/ccs.jsnpm error dest /usr/local/bin/ccs</code></pre><p><strong>原因</strong>：macOS 的 <code>/usr/local/bin</code> 默认需要 root 权限写入，<code>npm -g</code> 全局安装时无法创建符号链接。</p><blockquote><p>⚠️ <strong>不建议使用 <code>sudo npm install -g</code></strong>。npm 包的 <code>postinstall</code> 脚本会以 root 权限执行任意代码，存在供应链攻击风险。更安全的做法是将全局包安装到用户目录，或直接使用 <code>npx</code>。</p></blockquote><h3 id="32-改用-npx-运行无需安装"><a class="markdownIt-Anchor" href="#32-改用-npx-运行无需安装"></a> 3.2 改用 npx 运行（无需安装）</h3><pre><code class="bash">npx claude-code-switch deepseek</code></pre><p><strong>踩坑 2：切换后无输出 / 环境变量未生效</strong></p><pre><code class="bash">npx claude-code-switch status# （没有任何输出）echo $ANTHROPIC_BASE_URL# （空）</code></pre><p><strong>原因</strong>：<code>~/.ccswitch/models.json</code> 配置文件不存在，ccswitch 找不到 API Key，导致切换命令实际上没有生效。</p><h3 id="33-创建-ccswitch-配置文件"><a class="markdownIt-Anchor" href="#33-创建-ccswitch-配置文件"></a> 3.3 创建 ccswitch 配置文件</h3><pre><code class="bash">mkdir -p ~/.ccswitchcat &gt; ~/.ccswitch/models.json &lt;&lt; 'EOF'&#123;  &quot;deepseek&quot;: &#123;    &quot;base_url&quot;: &quot;https://api.deepseek.com/anthropic&quot;,    &quot;api_key&quot;: &quot;sk-你的DeepSeekKey&quot;,    &quot;model&quot;: &quot;deepseek-chat&quot;  &#125;,  &quot;kimi&quot;: &#123;    &quot;base_url&quot;: &quot;https://api.moonshot.cn/anthropic&quot;,    &quot;api_key&quot;: &quot;sk-你的KimiKey&quot;,    &quot;model&quot;: &quot;kimi-k2-thinking-turbo&quot;  &#125;&#125;EOF</code></pre><p><strong>踩坑 3：填好 Key 后仍然无效</strong></p><p>即使配置文件存在且 Key 正确，<code>npx claude-code-switch deepseek</code> 执行后仍然没有任何反馈，<code>echo $ANTHROPIC_BASE_URL</code> 依然为空。</p><p><strong>结论</strong>：ccswitch 工具在当前版本（0.0.7）下存在稳定性问题，<strong>不建议作为主要生产工具</strong>。我们转而使用更直接、更可靠的手动环境变量配置方案。</p><hr /><h2 id="四-最终推荐方案手动配置环境变量"><a class="markdownIt-Anchor" href="#四-最终推荐方案手动配置环境变量"></a> 四、最终推荐方案：手动配置环境变量</h2><p>这是最透明、最稳定的方式，没有中间工具，出了问题一眼就能看出来。</p><h3 id="41-获取-api-key"><a class="markdownIt-Anchor" href="#41-获取-api-key"></a> 4.1 获取 API Key</h3><table><thead><tr><th>厂商</th><th>申请地址</th><th>特点</th></tr></thead><tbody><tr><td><strong>DeepSeek</strong></td><td><a href="https://platform.deepseek.com">platform.deepseek.com</a></td><td>推理能力强，性价比高，推荐优先使用</td></tr><tr><td><strong>Kimi</strong></td><td><a href="https://platform.moonshot.cn">platform.moonshot.cn</a></td><td>上下文长达 256K，编程能力优秀</td></tr><tr><td><strong>GLM</strong></td><td><a href="https://open.bigmodel.cn">open.bigmodel.cn</a></td><td>免费额度高，日常编码够用</td></tr><tr><td><strong>MiniMax</strong></td><td><a href="https://platform.minimaxi.com">platform.minimaxi.com</a></td><td>长上下文优秀，价格低</td></tr></tbody></table><p>注册后进入「API Keys」页面，创建并复制 Key。</p><h3 id="42-在当前终端手动设置临时生效"><a class="markdownIt-Anchor" href="#42-在当前终端手动设置临时生效"></a> 4.2 在当前终端手动设置（临时生效）</h3><p>把 <code>sk-你的DeepSeekKey</code> 替换为真实 Key，在当前终端执行：</p><pre><code class="bash">export ANTHROPIC_BASE_URL=&quot;https://api.deepseek.com/anthropic&quot;export ANTHROPIC_AUTH_TOKEN=&quot;sk-你的DeepSeekKey&quot;export ANTHROPIC_MODEL=&quot;deepseek-chat&quot;</code></pre><p>验证是否生效：</p><pre><code class="bash">echo $ANTHROPIC_BASE_URL# 输出：https://api.deepseek.com/anthropic</code></pre><p>启动 Claude Code：</p><pre><code class="bash">claude</code></pre><p>如果左下角显示 <code>deepseek-v4-pro</code>（或类似的 DeepSeek 模型标识），说明配置成功。</p><hr /><h2 id="五-长期化配置写入-~zshrc"><a class="markdownIt-Anchor" href="#五-长期化配置写入-~zshrc"></a> 五、长期化配置：写入 ~/.zshrc</h2><p>上面的 <code>export</code> 只对<strong>当前终端窗口</strong>有效，关闭后失效。为了方便长期使用，我们将配置写入 <code>~/.zshrc</code>。</p><h3 id="51-编辑-~zshrc"><a class="markdownIt-Anchor" href="#51-编辑-~zshrc"></a> 5.1 编辑 ~/.zshrc</h3><pre><code class="bash">open -e ~/.zshrc# 或者使用 VS Code：code ~/.zshrc</code></pre><p>在文件末尾追加以下内容（<strong>务必将 <code>sk-...</code> 替换为你的真实 API Key</strong>）：</p><pre><code class="bash"># ============================================# Claude Code 国内大模型切换配置# ============================================# DeepSeek 配置cc-ds() &#123;  export ANTHROPIC_BASE_URL=&quot;https://api.deepseek.com/anthropic&quot;  export ANTHROPIC_AUTH_TOKEN=&quot;sk-你的DeepSeekKey&quot;  export ANTHROPIC_MODEL=&quot;deepseek-chat&quot;  echo &quot;✅ 已切换至 DeepSeek&quot;&#125;# Kimi 配置cc-kimi() &#123;  export ANTHROPIC_BASE_URL=&quot;https://api.moonshot.cn/anthropic&quot;  export ANTHROPIC_AUTH_TOKEN=&quot;sk-你的KimiKey&quot;  export ANTHROPIC_MODEL=&quot;kimi-k2-thinking-turbo&quot;  echo &quot;✅ 已切换至 Kimi&quot;&#125;# GLM 配置（可选）cc-glm() &#123;  export ANTHROPIC_BASE_URL=&quot;https://open.bigmodel.cn/api/anthropic&quot;  export ANTHROPIC_AUTH_TOKEN=&quot;sk-你的GLMKey&quot;  export ANTHROPIC_MODEL=&quot;glm-4-7&quot;  echo &quot;✅ 已切换至 GLM&quot;&#125;# 恢复官方 Claudecc-official() &#123;  unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN ANTHROPIC_MODEL  echo &quot;✅ 已恢复官方 Claude&quot;&#125;# 快捷启动命令ccd() &#123; cc-ds; claude &quot;$@&quot;; &#125;cck() &#123; cc-kimi; claude &quot;$@&quot;; &#125;ccg() &#123; cc-glm; claude &quot;$@&quot;; &#125;</code></pre><h3 id="52-重新加载配置"><a class="markdownIt-Anchor" href="#52-重新加载配置"></a> 5.2 重新加载配置</h3><pre><code class="bash">source ~/.zshrc</code></pre><hr /><h2 id="六-日常使用速查表"><a class="markdownIt-Anchor" href="#六-日常使用速查表"></a> 六、日常使用速查表</h2><p>配置完成后，以下是常用的快捷命令：</p><table><thead><tr><th>命令</th><th>作用</th></tr></thead><tbody><tr><td><code>ccd</code></td><td>启动 DeepSeek 版 Claude Code</td></tr><tr><td><code>cck</code></td><td>启动 Kimi 版 Claude Code</td></tr><tr><td><code>ccg</code></td><td>启动 GLM 版 Claude Code</td></tr><tr><td><code>cc-ds</code></td><td>仅切换环境变量到 DeepSeek（不启动 Claude Code）</td></tr><tr><td><code>cc-kimi</code></td><td>仅切换环境变量到 Kimi</td></tr><tr><td><code>cc-official</code></td><td>恢复官方 Claude（取消所有环境变量）</td></tr></tbody></table><h3 id="61-验证当前使用的模型"><a class="markdownIt-Anchor" href="#61-验证当前使用的模型"></a> 6.1 验证当前使用的模型</h3><p>在 Claude Code 运行界面，左下角会显示当前模型名称，例如：</p><pre><code>deepseek-v4-pro · API Usage Billing</code></pre><p>或者在终端执行：</p><pre><code class="bash">echo $ANTHROPIC_MODEL</code></pre><hr /><h2 id="七-主流模型配置参数速查"><a class="markdownIt-Anchor" href="#七-主流模型配置参数速查"></a> 七、主流模型配置参数速查</h2><table><thead><tr><th>厂商</th><th>兼容接口地址（<code>ANTHROPIC_BASE_URL</code>）</th><th>推荐模型名</th><th>特点</th></tr></thead><tbody><tr><td>DeepSeek</td><td><code>https://api.deepseek.com/anthropic</code></td><td><code>deepseek-chat</code> / <code>deepseek-reasoner</code></td><td>推理能力强，性价比高</td></tr><tr><td>Kimi</td><td><code>https://api.moonshot.cn/anthropic</code></td><td><code>kimi-k2-thinking-turbo</code></td><td>256K 长上下文，编程优秀</td></tr><tr><td>GLM</td><td><code>https://open.bigmodel.cn/api/anthropic</code></td><td><code>glm-4-7</code></td><td>免费额度高，日常编码够用</td></tr><tr><td>MiniMax</td><td><code>https://api.minimaxi.com/anthropic</code></td><td><code>minimax-m2</code></td><td>长上下文优秀，价格低</td></tr></tbody></table><hr /><h2 id="八-常见问题"><a class="markdownIt-Anchor" href="#八-常见问题"></a> 八、常见问题</h2><h3 id="q1claude-code-启动后仍然显示-unable-to-connect-to-anthropic-services"><a class="markdownIt-Anchor" href="#q1claude-code-启动后仍然显示-unable-to-connect-to-anthropic-services"></a> Q1：Claude Code 启动后仍然显示 “Unable to connect to Anthropic services”</h3><p><strong>排查步骤</strong>：</p><ol><li>检查环境变量是否生效：<code>echo $ANTHROPIC_BASE_URL</code></li><li>如果为空，说明当前终端没有正确加载配置，重新执行 <code>source ~/.zshrc</code></li><li>检查 API Key 是否正确（Key 错误会导致认证失败）</li><li>检查网络是否能访问对应平台（如 <code>curl https://api.deepseek.com</code>）</li></ol><h3 id="q2新开的终端窗口需要重新设置环境变量吗"><a class="markdownIt-Anchor" href="#q2新开的终端窗口需要重新设置环境变量吗"></a> Q2：新开的终端窗口需要重新设置环境变量吗？</h3><p><strong>答</strong>：如果已经按照第五节写入了 <code>~/.zshrc</code>，并且执行过 <code>source ~/.zshrc</code>，则新终端会自动继承配置。但环境变量<strong>不会自动切换模型</strong>，需要手动执行 <code>cc-ds</code> 或直接使用 <code>ccd</code> 启动。</p><h3 id="q3如何让-claude-code-默认使用国内模型而不是每次手动切换"><a class="markdownIt-Anchor" href="#q3如何让-claude-code-默认使用国内模型而不是每次手动切换"></a> Q3：如何让 Claude Code 默认使用国内模型，而不是每次手动切换？</h3><p><strong>答</strong>：在 <code>~/.zshrc</code> 中直接写入 <code>export</code> 语句（而不是函数），这样每次打开终端就自动生效：</p><pre><code class="bash"># 默认使用 DeepSeekexport ANTHROPIC_BASE_URL=&quot;https://api.deepseek.com/anthropic&quot;export ANTHROPIC_AUTH_TOKEN=&quot;sk-你的DeepSeekKey&quot;export ANTHROPIC_MODEL=&quot;deepseek-chat&quot;</code></pre><h3 id="q4api-调用费用如何"><a class="markdownIt-Anchor" href="#q4api-调用费用如何"></a> Q4：API 调用费用如何？</h3><p><strong>答</strong>：各平台都有免费额度，DeepSeek 和 GLM 的免费额度相对 generous。具体费率请查看各平台的官方定价页面。Claude Code 作为编程助手，代码补全和文件操作的 Token 消耗量通常不大。</p><hr /><h2 id="八-claude-code-入门常用命令与实战案例"><a class="markdownIt-Anchor" href="#八-claude-code-入门常用命令与实战案例"></a> 八、Claude Code 入门：常用命令与实战案例</h2><p>配置好模型只是第一步，下面介绍 Claude Code 的核心用法，帮助你快速上手这个终端 AI 编程助手。</p><h3 id="81-启动方式"><a class="markdownIt-Anchor" href="#81-启动方式"></a> 8.1 启动方式</h3><p>Claude Code 有两种启动方式：</p><table><thead><tr><th>方式</th><th>命令</th><th>说明</th></tr></thead><tbody><tr><td><strong>全局启动</strong></td><td><code>claude</code></td><td>在任意目录运行，Claude 可以访问整个文件系统</td></tr><tr><td><strong>项目内启动</strong></td><td><code>claude</code>（在项目根目录）</td><td>推荐方式，Claude 会自动聚焦当前项目上下文</td></tr></tbody></table><blockquote><p><strong>最佳实践</strong>：进入你的项目目录后再启动 Claude Code，这样它能自动识别项目结构、技术栈和依赖关系。</p></blockquote><pre><code class="bash">cd ~/my-projectccd  # 或 cck，取决于你配置的快捷命令</code></pre><hr /><h3 id="82-内置命令以-开头"><a class="markdownIt-Anchor" href="#82-内置命令以-开头"></a> 8.2 内置命令（以 <code>/</code> 开头）</h3><p>在 Claude Code 交互界面中，输入 <code>?</code> 可查看所有快捷命令。以下是核心命令：</p><table><thead><tr><th>命令</th><th>作用</th><th>使用场景</th></tr></thead><tbody><tr><td><code>/init</code></td><td>初始化 <code>CLAUDE.md</code> 文件</td><td>在新项目中创建 AI 助手的行为规范文档</td></tr><tr><td><code>/help</code></td><td>显示帮助信息</td><td>忘记命令时快速查询</td></tr><tr><td><code>/review</code></td><td>代码审查</td><td>让 Claude 检查当前文件的代码质量、潜在 Bug</td></tr><tr><td><code>/commit</code></td><td>自动提交 Git 变更</td><td>Claude 会生成规范的 commit message 并提交</td></tr><tr><td><code>/pr</code></td><td>创建 Pull Request</td><td>自动总结变更并创建 PR 描述（需配合 GitHub CLI）</td></tr><tr><td><code>/fix</code></td><td>自动修复问题</td><td>当 Claude 发现错误或 linter 报错时使用</td></tr><tr><td><code>/test</code></td><td>运行测试</td><td>执行项目测试套件并分析失败原因</td></tr><tr><td><code>/clear</code></td><td>清空对话历史</td><td>上下文太长时重置会话</td></tr><tr><td><code>/theme</code></td><td>切换终端主题</td><td>更改代码高亮和界面配色</td></tr><tr><td><code>/cost</code></td><td>查看 API 用量</td><td>监控本次会话的 Token 消耗和费用</td></tr><tr><td><code>/exit</code> 或 <code>Ctrl+D</code></td><td>退出 Claude Code</td><td>结束当前会话</td></tr></tbody></table><h4 id="使用示例"><a class="markdownIt-Anchor" href="#使用示例"></a> 使用示例</h4><pre><code>&gt; /reviewClaude 会分析你当前打开的文件，指出：- 潜在的逻辑错误- 性能优化建议- 代码风格问题- 安全风险</code></pre><hr /><h3 id="83-日常交互模式"><a class="markdownIt-Anchor" href="#83-日常交互模式"></a> 8.3 日常交互模式</h3><p>Claude Code 的核心使用方式是<strong>自然语言对话</strong>。你可以像和同事交流一样描述需求。</p><h4 id="场景-1代码生成"><a class="markdownIt-Anchor" href="#场景-1代码生成"></a> 场景 1：代码生成</h4><pre><code>&gt; 帮我写一个 Python 函数，读取 CSV 文件并返回按日期排序的 DataFrameClaude 会：1. 询问 CSV 的日期列名（或根据上下文推断）2. 生成带类型注解和文档字符串的函数3. 询问是否需要处理异常（如文件不存在、日期格式错误）4. 将代码写入你指定的文件</code></pre><h4 id="场景-2代码重构"><a class="markdownIt-Anchor" href="#场景-2代码重构"></a> 场景 2：代码重构</h4><pre><code>&gt; 把 src/utils.py 里的重复逻辑提取成独立函数Claude 会：1. 读取 src/utils.py2. 识别重复代码块3. 提出重构方案（展示 diff）4. 经你确认后执行修改</code></pre><h4 id="场景-3debug-调试"><a class="markdownIt-Anchor" href="#场景-3debug-调试"></a> 场景 3：Debug 调试</h4><pre><code>&gt; 运行项目测试时报错了，帮我看看Claude 会：1. 执行测试命令（如 pytest / npm test）2. 分析错误堆栈3. 定位问题根源4. 提出修复方案或自动修复</code></pre><h4 id="场景-4批量文件操作"><a class="markdownIt-Anchor" href="#场景-4批量文件操作"></a> 场景 4：批量文件操作</h4><pre><code>&gt; 把所有 .js 文件里的 console.log 替换成 logger.debugClaude 会：1. 搜索项目中的所有 .js 文件2. 展示将要修改的文件列表3. 经确认后执行批量替换4. 生成变更摘要</code></pre><hr /><h3 id="84-文件与代码操作"><a class="markdownIt-Anchor" href="#84-文件与代码操作"></a> 8.4 文件与代码操作</h3><p>Claude Code 可以直接操作文件系统，所有修改都会征求你的确认。</p><h4 id="读取文件"><a class="markdownIt-Anchor" href="#读取文件"></a> 读取文件</h4><pre><code>&gt; 看一下 src/App.tsx 的内容&gt; 比较 src/old.js 和 src/new.js 的区别&gt; 搜索项目中所有用到 useEffect 的地方</code></pre><h4 id="创建文件"><a class="markdownIt-Anchor" href="#创建文件"></a> 创建文件</h4><pre><code>&gt; 创建一个 Dockerfile，基于 Node 18 镜像，暴露 3000 端口&gt; 在 tests/ 目录下添加 login.spec.js 的 Playwright 测试</code></pre><h4 id="编辑文件"><a class="markdownIt-Anchor" href="#编辑文件"></a> 编辑文件</h4><pre><code>&gt; 在 README.md 的安装章节后面添加 Troubleshooting 部分&gt; 给 src/api.js 里的 fetchUser 函数添加重试逻辑&gt; 删除 src/components/OldComponent.jsx（已废弃）</code></pre><h4 id="运行终端命令"><a class="markdownIt-Anchor" href="#运行终端命令"></a> 运行终端命令</h4><p>Claude Code 可以代表你运行终端命令，执行前会请求确认：</p><pre><code>&gt; 安装 axios 和 lodashClaude: 我将运行 `npm install axios lodash`，是否继续？ (Y/n)&gt; 把当前分支推送到远程Claude: 我将运行 `git push origin feature-branch`，是否继续？ (Y/n)</code></pre><hr /><h3 id="85-项目初始化claudemd"><a class="markdownIt-Anchor" href="#85-项目初始化claudemd"></a> 8.5 项目初始化：<a href="http://CLAUDE.md">CLAUDE.md</a></h3><p><code>/init</code> 命令会在项目根目录创建一个 <code>CLAUDE.md</code> 文件，这是给 Claude 的&quot;项目说明书&quot;。</p><p><strong><a href="http://CLAUDE.md">CLAUDE.md</a> 的作用</strong>：</p><ul><li>描述项目架构和技术栈</li><li>定义编码规范（缩进、命名约定、注释风格）</li><li>指定测试策略和目录结构</li><li>列出需要特别注意的业务逻辑</li></ul><p><strong>示例 <a href="http://CLAUDE.md">CLAUDE.md</a></strong>：</p><pre><code class="markdown"># 项目规范## 技术栈- React 18 + TypeScript- Vite 构建工具- Tailwind CSS- React Query 管理服务端状态## 编码规范- 使用函数组件 + Hooks- 类型定义放在 `src/types/` 目录- API 请求统一封装在 `src/api/` 目录- 组件 props 必须写接口定义## 测试要求- 新增功能必须配套单元测试- 使用 Vitest + React Testing Library- 测试文件放在 `__tests__/` 目录或 `.test.ts` 后缀</code></pre><p>创建后，Claude 在后续对话中会自动遵循这些规范，无需每次重复说明。</p><hr /><h3 id="86-实战完整案例"><a class="markdownIt-Anchor" href="#86-实战完整案例"></a> 8.6 实战完整案例</h3><h4 id="案例从零搭建一个-express-api-项目"><a class="markdownIt-Anchor" href="#案例从零搭建一个-express-api-项目"></a> 案例：从零搭建一个 Express API 项目</h4><p><strong>步骤 1：创建项目目录并进入</strong></p><pre><code class="bash">mkdir my-api &amp;&amp; cd my-apiccd</code></pre><p><strong>步骤 2：初始化项目</strong></p><pre><code>&gt; 初始化一个 Node.js Express 项目，使用 TypeScript，添加 eslint 和 prettier 配置</code></pre><p>Claude 会：</p><ol><li>运行 <code>npm init -y</code></li><li>安装 <code>express</code>、<code>typescript</code>、<code>@types/express</code>、<code>eslint</code>、<code>prettier</code> 等依赖</li><li>创建 <code>tsconfig.json</code></li><li>创建 <code>.eslintrc.js</code> 和 <code>.prettierrc</code></li><li>创建 <code>src/index.ts</code> 入口文件</li></ol><p><strong>步骤 3：创建用户模块</strong></p><pre><code>&gt; 创建用户相关的 CRUD API，包括：&gt; - GET /users 获取用户列表&gt; - GET /users/:id 获取单个用户&gt; - POST /users 创建用户&gt; - PUT /users/:id 更新用户&gt; - DELETE /users/:id 删除用户&gt; &gt; 使用内存数组存储数据即可，先不做数据库</code></pre><p>Claude 会：</p><ol><li>创建 <code>src/routes/users.ts</code></li><li>创建 <code>src/types/user.ts</code> 定义 User 接口</li><li>在 <code>src/index.ts</code> 中注册路由</li><li>添加基本的输入验证</li></ol><p><strong>步骤 4：添加测试</strong></p><pre><code>&gt; 给用户模块添加 Jest 单元测试，覆盖所有路由</code></pre><p>Claude 会：</p><ol><li>安装 <code>jest</code>、<code>supertest</code>、<code>@types/jest</code></li><li>创建 <code>src/routes/users.test.ts</code></li><li>配置 <code>jest.config.js</code></li></ol><p><strong>步骤 5：代码审查</strong></p><pre><code>&gt; /review</code></pre><p>Claude 会检查代码中的潜在问题，比如：</p><ul><li>缺少错误处理中间件</li><li>没有输入校验</li><li>TypeScript 类型不够严谨</li></ul><p><strong>步骤 6：提交代码</strong></p><pre><code>&gt; /commit</code></pre><p>Claude 会自动：</p><ol><li><code>git add .</code></li><li>生成规范的 commit message（如 <code>feat: add user CRUD endpoints with tests</code>）</li><li><code>git commit</code></li></ol><hr /><h3 id="87-快捷键与效率技巧"><a class="markdownIt-Anchor" href="#87-快捷键与效率技巧"></a> 8.7 快捷键与效率技巧</h3><table><thead><tr><th>快捷键</th><th>作用</th></tr></thead><tbody><tr><td><code>Tab</code></td><td>自动补全 Claude 的建议</td></tr><tr><td><code>↑</code> / <code>↓</code></td><td>浏览历史输入</td></tr><tr><td><code>Ctrl+C</code></td><td>取消当前操作</td></tr><tr><td><code>Ctrl+D</code></td><td>退出 Claude Code</td></tr><tr><td><code>?</code></td><td>显示命令帮助</td></tr></tbody></table><h4 id="效率技巧"><a class="markdownIt-Anchor" href="#效率技巧"></a> 效率技巧</h4><ol><li><p><strong>多轮对话保持上下文</strong>：Claude Code 会记住整个会话的历史，你可以随时说&quot;刚才那个函数再改一下&quot;或&quot;回到上一步&quot;。</p></li><li><p><strong>@ 引用文件</strong>：在对话中用 <code>@文件名</code> 快速让 Claude 关注特定文件。</p><pre><code>&gt; @src/utils.js 里的 parseDate 函数有 bug，帮我修复</code></pre></li><li><p><strong>批量确认</strong>：Claude 在执行危险操作（如删除文件、git push）前会征求确认。你可以输入 <code>Y</code> 确认单条，<code>A</code> 确认全部剩余操作，<code>N</code> 跳过，<code>Q</code> 退出。</p></li><li><p><strong>查看成本</strong>：随时输入 <code>/cost</code> 了解当前会话消耗了多少 Token，便于控制预算。</p></li><li><p><strong>结合 tmux/screen</strong>：在 tmux 会话中运行 Claude Code，即使关闭终端也不会中断长任务。</p></li></ol><hr /><h3 id="88-使用注意事项"><a class="markdownIt-Anchor" href="#88-使用注意事项"></a> 8.8 使用注意事项</h3><table><thead><tr><th>注意点</th><th>说明</th></tr></thead><tbody><tr><td><strong>Git 状态</strong></td><td>Claude Code 会自动检测 Git 变更，建议在干净的工作区启动，或先提交现有改动</td></tr><tr><td><strong>大文件</strong></td><td>避免让 Claude 读取过大的二进制文件或日志文件，会消耗大量 Token</td></tr><tr><td><strong>敏感信息</strong></td><td>不要让 Claude 读取包含密码、API Key、私钥的文件</td></tr><tr><td><strong>确认机制</strong></td><td>所有文件修改和命令执行默认需要确认，不要轻易输入 <code>A</code>（全部确认）</td></tr><tr><td><strong>网络状态</strong></td><td>使用国内模型时，确保网络可以稳定访问对应平台（DeepSeek/Kimi/GLM）</td></tr></tbody></table><hr /><hr /><h2 id="九-skills-系统详解扩展-claude-code-的能力边界"><a class="markdownIt-Anchor" href="#九-skills-系统详解扩展-claude-code-的能力边界"></a> 九、Skills 系统详解：扩展 Claude Code 的能力边界</h2><p>Claude Code 的 Skills 系统是其最强大的特性之一。通过 Skills，你可以为 Claude 注入特定领域的知识、编码规范、团队约定，甚至自定义命令。本节将详细讲解 Skills 的安装、作用范围，以及国内网络环境下的最佳实践。</p><h3 id="91-skills-是什么"><a class="markdownIt-Anchor" href="#91-skills-是什么"></a> 9.1 Skills 是什么</h3><p>简单来说，<strong>Skill 是一个包含 <code>SKILL.md</code> 文件的文件夹</strong>，里面写满了给 Claude 的「专项 Instructions」。安装后，Claude 在对应场景下会自动调用这些知识。</p><p><strong>类比理解</strong>：</p><ul><li>如果把 Claude Code 比作一个通用程序员</li><li>那么 Skills 就是他的「专业资格证书」——装上 React Skill，他就是一个熟手 React 开发者；装上 Testing Skill，他就精通各种测试框架</li></ul><p><strong>典型使用场景</strong>：</p><ul><li>团队编码规范（缩进、命名、注释风格）</li><li>特定技术栈的深度知识（Next.js、Django、Rust 等）</li><li>内部工具链的使用方法（私有 npm 仓库、内部 CLI）</li><li>代码审查标准（安全规范、性能要求）</li></ul><h3 id="92-skills-的两种作用范围"><a class="markdownIt-Anchor" href="#92-skills-的两种作用范围"></a> 9.2 Skills 的两种作用范围</h3><p>这是最容易混淆的地方。<strong>Claude Code 的 Skills 同时支持全局和项目级两种作用范围</strong>，优先级规则是：<strong>项目级 &gt; 全局</strong>。</p><h4 id="全局-skills用户级"><a class="markdownIt-Anchor" href="#全局-skills用户级"></a> 全局 Skills（用户级）</h4><table><thead><tr><th>属性</th><th>说明</th></tr></thead><tbody><tr><td><strong>存放位置</strong></td><td><code>~/.claude/skills/</code></td></tr><tr><td><strong>作用范围</strong></td><td>当前用户的<strong>所有项目</strong></td></tr><tr><td><strong>适用场景</strong></td><td>个人通用工具、跨项目都会用到的规范</td></tr></tbody></table><p><strong>示例</strong>：你个人习惯使用 2 空格缩进、单引号、尾部逗号，可以把这些偏好写入一个全局 Skill，这样每个项目都会自动遵循。</p><h4 id="项目级-skills局部默认"><a class="markdownIt-Anchor" href="#项目级-skills局部默认"></a> 项目级 Skills（局部，默认）</h4><table><thead><tr><th>属性</th><th>说明</th></tr></thead><tbody><tr><td><strong>存放位置</strong></td><td><code>./.claude/skills/</code>（项目根目录下）</td></tr><tr><td><strong>作用范围</strong></td><td><strong>仅当前项目</strong></td></tr><tr><td><strong>适用场景</strong></td><td>团队规范、项目特定的技术栈、协作共享</td></tr></tbody></table><p><strong>示例</strong>：公司 A 项目使用 Vue + Pinia + Element Plus，有一套特定的组件封装规范。把这些写入项目级 Skill，提交到 Git 仓库，团队所有人都能获得一致的 AI 辅助体验。</p><h4 id="优先级规则"><a class="markdownIt-Anchor" href="#优先级规则"></a> 优先级规则</h4><p>当全局和项目级存在同名 Skill 时，<strong>项目级优先</strong>。这意味着：</p><ul><li>你可以有一个全局的「通用代码规范」Skill</li><li>同时在某个项目中放置「该项目特定的规范」Skill</li><li>Claude 会优先遵循项目级的约定</li></ul><h3 id="93-安装-skills-的两种方式"><a class="markdownIt-Anchor" href="#93-安装-skills-的两种方式"></a> 9.3 安装 Skills 的两种方式</h3><h4 id="方式一插件市场安装推荐网络通畅时"><a class="markdownIt-Anchor" href="#方式一插件市场安装推荐网络通畅时"></a> 方式一：插件市场安装（推荐，网络通畅时）</h4><p>Claude Code 内置了插件市场体系，类似于 npm 的包管理。</p><p><strong>核心命令</strong>：</p><pre><code class="bash"># 查看已添加的市场/plugin marketplace list# 添加市场（必须使用 HTTPS 地址）/plugin marketplace add https://github.com/anthropics/claude-plugins-official# 浏览市场可用插件/plugin marketplace list# 安装插件（格式：插件名@市场名）/plugin install code-review@claude-plugins-official# 查看已安装插件/plugin list# 启用/禁用插件/plugin enable 插件名@市场名/plugin disable 插件名@市场名# 卸载插件/plugin uninstall 插件名@市场名</code></pre><p><strong>⚠️ 重要注意</strong>：<code>/plugin install</code> <strong>默认安装到项目级</strong>（<code>./.claude/skills/</code>），不是全局的。这意味着：</p><ul><li>你在项目 A 安装了 Skill</li><li>进入项目 B 后，该 Skill <strong>不可用</strong></li></ul><p><strong>如果你想让所有项目都能用</strong>，安装后需要手动复制到全局目录：</p><pre><code class="bash"># 从项目级复制到全局（macOS/Linux）cp -r ./.claude/skills/skill-name ~/.claude/skills/</code></pre><h4 id="方式二本地手动安装离线环境-国内网络受限时"><a class="markdownIt-Anchor" href="#方式二本地手动安装离线环境-国内网络受限时"></a> 方式二：本地手动安装（离线环境、国内网络受限时）</h4><p>如果网络不畅或处于离线环境，可以直接将 Skill 文件夹复制到指定目录。</p><p><strong>步骤 1：获取 Skill 文件</strong></p><p>从 GitHub 下载 Skill 仓库的 ZIP 包，解压后得到 Skill 文件夹（内部应包含 <code>SKILL.md</code> 文件）。</p><p><strong>步骤 2：复制到目标目录</strong></p><pre><code class="bash"># 全局安装（所有项目可用）cp -r /path/to/skill-folder ~/.claude/skills/# 项目级安装（仅当前项目可用）mkdir -p ./.claude/skillscp -r /path/to/skill-folder ./.claude/skills/</code></pre><p><strong>步骤 3：验证安装</strong></p><p>重启 Claude Code，然后询问：</p><pre><code>&gt; 你有哪些可用的 Skills？</code></pre><p>如果 Claude 列出了你刚安装的 Skill，说明安装成功。</p><h3 id="94-国内网络环境下的-skills-安装策略"><a class="markdownIt-Anchor" href="#94-国内网络环境下的-skills-安装策略"></a> 9.4 国内网络环境下的 Skills 安装策略</h3><p>国内用户安装 Skills 时，最常见的问题是访问 GitHub 慢或超时。以下是几种经过验证的解决方案：</p><h4 id="策略-1配置-git-代理推荐"><a class="markdownIt-Anchor" href="#策略-1配置-git-代理推荐"></a> 策略 1：配置 Git 代理（推荐）</h4><p>如果你已经有代理工具（Clash、Surge、V2Ray 等），配置 Git 走代理：</p><pre><code class="bash"># HTTP 代理git config --global http.proxy http://127.0.0.1:7890git config --global https.proxy http://127.0.0.1:7890# SOCKS5 代理（部分工具使用）git config --global http.proxy socks5://127.0.0.1:7890</code></pre><blockquote><p>端口号 <code>7890</code> 请替换为你实际代理工具的 HTTP/SOCKS5 端口（Clash 默认 7890，Surge 默认 6152）。</p></blockquote><p>配置后，<code>/plugin marketplace add</code> 和 <code>/plugin install</code> 命令就可以正常访问 GitHub 了。</p><h4 id="策略-2使用-github-镜像站"><a class="markdownIt-Anchor" href="#策略-2使用-github-镜像站"></a> 策略 2：使用 GitHub 镜像站</h4><p>如果不想配置代理，可以使用国内的 GitHub 镜像站：</p><pre><code class="bash"># 添加市场时使用镜像地址/plugin marketplace add https://gh.api.99988866.xyz/https://github.com/anthropics/claude-plugins-official</code></pre><p>常用镜像前缀：</p><ul><li><code>https://gh.api.99988866.xyz/https://github.com/...</code></li><li><code>https://mirror.ghproxy.com/https://github.com/...</code></li><li><code>https://ghps.cc/https://github.com/...</code></li></ul><blockquote><p>镜像站稳定性不一，如果某个失效，尝试换一个。</p></blockquote><h4 id="策略-3完全离线安装内网无网络环境"><a class="markdownIt-Anchor" href="#策略-3完全离线安装内网无网络环境"></a> 策略 3：完全离线安装（内网/无网络环境）</h4><p>这是最稳妥的方案，适合公司内网或完全无法访问外网的环境。</p><p><strong>步骤 1：在能上网的机器上下载 Skills</strong></p><p>访问 Claude Code 官方插件仓库或社区仓库，下载 ZIP 包：</p><ul><li>官方市场：<code>https://github.com/anthropics/claude-plugins-official</code></li><li>社区市场：搜索 <code>claude code skills github</code></li></ul><p><strong>步骤 2：传输到目标机器</strong></p><p>通过 U 盘、内网文件服务器、企业微信/钉钉等方式，将解压后的 Skill 文件夹传输到目标 macOS 机器。</p><p><strong>步骤 3：手动安装</strong></p><pre><code class="bash"># 创建全局 skills 目录mkdir -p ~/.claude/skills# 复制 Skill 文件夹（假设传输到了 ~/Downloads/skills/）cp -r ~/Downloads/skills/* ~/.claude/skills/# 验证目录结构ls -la ~/.claude/skills/# 应该看到各个 Skill 文件夹，每个文件夹内有 SKILL.md</code></pre><p><strong>步骤 4：重启 Claude Code 并使用</strong></p><pre><code class="bash">ccd</code></pre><pre><code>&gt; 你有哪些可用的 Skills？&gt; /skill-name  # 调用特定 Skill</code></pre><h3 id="95-热门-skills-推荐"><a class="markdownIt-Anchor" href="#95-热门-skills-推荐"></a> 9.5 热门 Skills 推荐</h3><p>以下是社区中评价较高的 Skills，供参考：</p><table><thead><tr><th>Skill</th><th>作用</th><th>推荐级别</th></tr></thead><tbody><tr><td><code>code-review</code></td><td>代码审查规范，自动检查 Bug、性能问题、安全漏洞</td><td>⭐⭐⭐⭐⭐</td></tr><tr><td><code>testing</code></td><td>测试框架最佳实践，生成单元测试、集成测试</td><td>⭐⭐⭐⭐⭐</td></tr><tr><td><code>security</code></td><td>安全编码规范，识别 SQL 注入、XSS、敏感信息泄露</td><td>⭐⭐⭐⭐⭐</td></tr><tr><td><code>react</code></td><td>React 开发规范，Hooks 使用、组件设计模式</td><td>⭐⭐⭐⭐</td></tr><tr><td><code>typescript</code></td><td>TypeScript 高级类型、严格模式配置</td><td>⭐⭐⭐⭐</td></tr><tr><td><code>documentation</code></td><td>自动生成和优化代码注释、README</td><td>⭐⭐⭐⭐</td></tr></tbody></table><p>安装方法示例：</p><pre><code class="bash">/plugin install code-review@claude-plugins-official/plugin install testing@claude-plugins-official</code></pre><h3 id="96-自定义自己的-skill"><a class="markdownIt-Anchor" href="#96-自定义自己的-skill"></a> 9.6 自定义自己的 Skill</h3><p>如果现成的 Skills 不能满足需求，你可以自己写一个。</p><p><strong>步骤 1：创建 Skill 目录和文件</strong></p><pre><code class="bash">mkdir -p ~/.claude/skills/my-team-rulescat &gt; ~/.claude/skills/my-team-rules/SKILL.md &lt;&lt; 'EOF'# My Team Coding Rules## 命名规范- 变量/函数：camelCase- 组件/类：PascalCase- 常量：UPPER_SNAKE_CASE- 私有属性：_前缀## 代码风格- 缩进：2 个空格- 引号：单引号- 分号：必须- 行尾逗号：多行时必须## 文件组织- 组件放在 `src/components/`- 工具函数放在 `src/utils/`- API 封装放在 `src/api/`- 类型定义放在 `src/types/`## 提交规范- feat: 新功能- fix: 修复- docs: 文档- style: 格式- refactor: 重构- test: 测试- chore: 构建/工具EOF</code></pre><p><strong>步骤 2：重启 Claude Code 即可生效</strong></p><p>现在当你让 Claude 写代码时，他会自动遵循你定义的规范。</p><h3 id="97-skills-使用注意事项"><a class="markdownIt-Anchor" href="#97-skills-使用注意事项"></a> 9.7 Skills 使用注意事项</h3><table><thead><tr><th>注意点</th><th>说明</th></tr></thead><tbody><tr><td><strong>版本要求</strong></td><td>Skills 完整功能需要 Claude Code <strong>v2.1.0+</strong>，低版本可能不兼容</td></tr><tr><td><strong>文件命名</strong></td><td>Skill 核心文件必须命名为 <code>SKILL.md</code>（全大写），且直接放在 Skill 文件夹下，不要嵌套</td></tr><tr><td><strong>安全审查</strong></td><td>第三方 Skills 会执行其中的指令，生产环境优先使用官方或可信来源的 Skill</td></tr><tr><td><strong>冲突处理</strong></td><td>同名 Skill 项目级优先于全局，注意避免重复定义导致行为不一致</td></tr><tr><td><strong>性能影响</strong></td><td>安装的 Skills 越多，每次请求附带的上下文越长，Token 消耗越大，建议只安装必要的</td></tr></tbody></table><hr /><h2 id="写在最后"><a class="markdownIt-Anchor" href="#写在最后"></a> 写在最后</h2><p>Claude Code 的核心价值在于<strong>把 AI 能力无缝嵌入到终端工作流</strong>中。它不是一个简单的聊天机器人，而是能读懂你的代码、操作你的文件系统、运行你的测试、提交你的代码的&quot;编程搭档&quot;。</p><p>通过 Skills 系统，你可以进一步定制这个搭档的专业能力——无论是团队的编码规范、特定技术栈的深度知识，还是个人的开发偏好，都能通过 Skills 注入到 Claude 中，让它真正成为&quot;懂你的 AI&quot;。</p><p>配合 DeepSeek 或 Kimi 等国内模型，即使在不方便访问 Anthropic 官方服务的环境下，你也能获得流畅且高度个性化的 AI 编程体验。</p><p>建议从一个小功能或一次代码重构开始尝试，逐步熟悉它的交互模式。你会发现，很多原本需要查文档、写样板代码、反复调试的工作，现在只需几句话就能完成。</p><p>祝你编码愉快！</p><hr /><h2 id="十-总结"><a class="markdownIt-Anchor" href="#十-总结"></a> 十、总结</h2><p>本文记录了在 macOS 上安装和配置 Claude Code 的完整过程，重点解决了国内网络环境下无法连接 Anthropic 官方服务的问题。</p><p><strong>核心要点</strong>：</p><ul><li>Claude Code 通过 Anthropic Messages API 通信，国内模型提供了兼容接口</li><li>修改 <code>ANTHROPIC_BASE_URL</code>、<code>ANTHROPIC_AUTH_TOKEN</code>、<code>ANTHROPIC_MODEL</code> 三个环境变量即可切换</li><li><code>ccswitch</code> 工具目前不够稳定，推荐直接手动配置 + 写入 <code>~/.zshrc</code></li><li>使用 <code>npx</code> 或用户级 npm 全局目录，避免 <code>sudo npm install -g</code> 的安全风险</li></ul><p>现在，输入 <code>ccd</code> 或 <code>cck</code>，开始你的 AI 编程之旅吧。</p><hr /><p><em>参考链接</em></p><ul><li>Claude Code 官方文档：<a href="https://docs.anthropic.com/en/docs/claude-code/overview">https://docs.anthropic.com/en/docs/claude-code/overview</a></li><li>DeepSeek API 平台：<a href="https://platform.deepseek.com">https://platform.deepseek.com</a></li><li>Kimi API 平台：<a href="https://platform.moonshot.cn">https://platform.moonshot.cn</a></li><li>ccswitch 项目：<a href="https://github.com/yourccswitch/claude-code-switch">https://github.com/yourccswitch/claude-code-switch</a></li></ul>]]>
    </content>
    <id>https://blog.zhengxi.me/posts/8420561379/</id>
    <link href="https://blog.zhengxi.me/posts/8420561379/"/>
    <published>2026-04-24T23:13:25.000Z</published>
    <summary>
      <![CDATA[<blockquote>
<p><strong>适用环境</strong>：macOS（Intel / Apple Silicon）+ Homebrew + zsh<br />
<strong>目标</strong>：在无法直接访问 Anthropic 官方服务的环境下，让 Claude Code]]>
    </summary>
    <title>Mac 用户 Claude Code 完全配置指南：接入 DeepSeek / Kimi 等国内大模型</title>
    <updated>2026-04-24T15:32:12.000Z</updated>
  </entry>
  <entry>
    <author>
      <name>ZhengXi</name>
    </author>
    <category term="食用菌研究" scheme="https://blog.zhengxi.me/categories/%E9%A3%9F%E7%94%A8%E8%8F%8C%E7%A0%94%E7%A9%B6/"/>
    <category term="食用菌" scheme="https://blog.zhengxi.me/tags/%E9%A3%9F%E7%94%A8%E8%8F%8C/"/>
    <category term="分子鉴定" scheme="https://blog.zhengxi.me/tags/%E5%88%86%E5%AD%90%E9%89%B4%E5%AE%9A/"/>
    <category term="PCR引物" scheme="https://blog.zhengxi.me/tags/PCR%E5%BC%95%E7%89%A9/"/>
    <category term="灵芝" scheme="https://blog.zhengxi.me/tags/%E7%81%B5%E8%8A%9D/"/>
    <category term="硫磺菌" scheme="https://blog.zhengxi.me/tags/%E7%A1%AB%E7%A3%BA%E8%8F%8C/"/>
    <category term="羊肚菌" scheme="https://blog.zhengxi.me/tags/%E7%BE%8A%E8%82%9A%E8%8F%8C/"/>
    <category term="ITS" scheme="https://blog.zhengxi.me/tags/ITS/"/>
    <content>
      <![CDATA[<blockquote><p>基于 <strong>rDNA（核糖体 DNA）</strong> 和 <strong>蛋白编码基因</strong> 的多基因分子鉴定方案</p></blockquote><hr /><h2 id="概述"><a class="markdownIt-Anchor" href="#概述"></a> 概述</h2><p>食用菌的传统形态学鉴定依赖于子实体的宏观特征（菌盖形状、菌褶颜色、孢子印等），但在以下场景中往往力不从心：</p><ul><li><strong>菌丝体阶段</strong>（无子实体）</li><li><strong>同物异名 / 同名异物</strong> 的分类混乱</li><li><strong>近缘种</strong> 形态高度相似（如灵芝属 <em>Ganoderma</em> 内部）</li><li><strong>药用菌真伪鉴别</strong>（市场掺假问题）</li></ul><p><strong>DNA 分子标记</strong> 通过 PCR 扩增保守区域的特异性序列，结合测序和数据库比对，已成为食用菌鉴定的金标准。</p><hr /><h2 id="一-常用分子标记概述"><a class="markdownIt-Anchor" href="#一-常用分子标记概述"></a> 一、常用分子标记概述</h2><table><thead><tr><th>基因位点</th><th>全称</th><th>特点</th><th>适用范围</th></tr></thead><tbody><tr><td><strong>ITS</strong></td><td>Internal Transcribed Spacer（内部转录间隔区）</td><td>真菌条形码，变异速率高，通用性好，UNITE 数据库成熟</td><td>种级及部分种下水平</td></tr><tr><td><strong>LSU</strong></td><td>Large Subunit rRNA（28S 大亚基）</td><td>保守性高于ITS，系统发育信号稳定</td><td>属级以上、种级辅助</td></tr><tr><td><strong>TEF1-α</strong></td><td>Translation Elongation Factor 1-alpha（翻译延伸因子1-α）</td><td>蛋白编码单拷贝基因，分辨率高，适合近缘种</td><td>种级 / 近缘复合种</td></tr><tr><td><strong>RPB1 / RPB2</strong></td><td>RNA Polymerase II subunits（RNA 聚合酶II大/二亚基）</td><td>低拷贝蛋白编码基因，系统发育信息丰富</td><td>属内细分、深度系统发育</td></tr></tbody></table><blockquote><p><strong>实际策略</strong>：通常采用 <strong>ITS 作为一级标记</strong> + <strong>至少一个蛋白编码基因（如 TEF1-α 或 RPB2）作为二级标记</strong> 的多基因联合分析，以提高鉴定可靠性。</p></blockquote><hr /><h2 id="二-灵芝-ganoderma-分子鉴定"><a class="markdownIt-Anchor" href="#二-灵芝-ganoderma-分子鉴定"></a> 二、灵芝 (<em>Ganoderma</em>) 分子鉴定</h2><p>灵芝属物种形态多变且存在大量隐存种（cryptic species），单一 ITS 标记往往不足以区分。建议使用 <strong>ITS + LSU + TEF1-α + RBP2 四基因联合鉴定</strong>。</p><h3 id="21-引物列表"><a class="markdownIt-Anchor" href="#21-引物列表"></a> 2.1 引物列表</h3><table><thead><tr><th>目标基因</th><th>引物名称</th><th>序列 (5’ → 3’)</th><th>扩增区域</th><th>预期产物</th></tr></thead><tbody><tr><td><strong>ITS</strong></td><td>ITS5</td><td><code>ggaagtaaaagtcgtaacaagg</code></td><td>ITS1–5.8S–ITS2 完整区</td><td>~600-650 bp</td></tr><tr><td></td><td>ITS4</td><td><code>tcctccgcttattgatatgc</code></td><td></td><td></td></tr><tr><td><strong>LSU</strong></td><td>LROR</td><td><code>acccgctgaacttaagc</code></td><td>28S D1–D2 区</td><td>~900 bp</td></tr><tr><td></td><td>LR5</td><td><code>tcctgagggaaacttcg</code></td><td></td><td></td></tr><tr><td><strong>TEF1-α</strong></td><td>983F</td><td><code>gcyccygghcaycgtgayttyat</code></td><td>TEF1-α 编码区</td><td>~550-600 bp</td></tr><tr><td></td><td>1567R</td><td><code>achgtrccrataccaccratctt</code></td><td></td><td></td></tr><tr><td><strong>RPB2</strong></td><td>fRrbp2-6F</td><td><code>tggggyatggtntgyccygc</code></td><td>RNA 聚合酶II二亚基</td><td>~700-800 bp</td></tr><tr><td></td><td>fRrbp2-7cR</td><td><code>cccatrgcttgyttrcccat</code></td><td></td><td></td></tr></tbody></table><blockquote><p><strong>简并碱基说明</strong>：<code>Y = C/T</code>，<code>R = A/G</code>，<code>H = A/C/T</code>，<code>K = G/T</code>，<code>D = A/G/T</code>，<code>N = A/C/G/T</code>。这些简并碱基确保引物能覆盖灵芝属内的序列变异。详见第六节「6.1 简并引物使用要点」。</p></blockquote><h3 id="22-推荐反应体系25-μl"><a class="markdownIt-Anchor" href="#22-推荐反应体系25-μl"></a> 2.2 推荐反应体系（25 μL）</h3><table><thead><tr><th>组分</th><th>终浓度</th><th>体积</th></tr></thead><tbody><tr><td>10× PCR Buffer (含 Mg²⁺)</td><td>1×</td><td>2.5 μL</td></tr><tr><td>dNTP Mix</td><td>200 μM each</td><td>0.5 μL</td></tr><tr><td>上游引物 (10 μM)</td><td>0.4 μM</td><td>1 μL</td></tr><tr><td>下游引物 (10 μM)</td><td>0.4 μM</td><td>1 μL</td></tr><tr><td>Taq DNA Polymerase (5 U/μL)</td><td>1 U</td><td>0.25 μL</td></tr><tr><td>模板 DNA</td><td>~20 ng</td><td>1 μL</td></tr><tr><td>ddH₂O</td><td>—</td><td>18.75 μL</td></tr></tbody></table><h3 id="23-pcr-循环参数"><a class="markdownIt-Anchor" href="#23-pcr-循环参数"></a> 2.3 PCR 循环参数</h3><pre><code>预变性    95°C  3 min变性      95°C  30 s退火      52°C  30 s   ← ITS/LSU 用 52°C；TEF1-α/RBP2 可降至 48-50°C延伸      72°C  45 s/bp（ITS 约 1 min，LSU 约 1.5 min）          └─ 35 个循环终延伸    72°C  10 min保持      4°C  ∞</code></pre><h3 id="24-专业补充为什么灵芝需要多基因"><a class="markdownIt-Anchor" href="#24-专业补充为什么灵芝需要多基因"></a> 2.4 专业补充：为什么灵芝需要多基因？</h3><p>灵芝属（<em>Ganoderma</em>）是真菌界&quot;分类噩梦&quot;之一：</p><ul><li><strong>形态特征趋同进化严重</strong>：不同物种在相同生境下可能演化出相似的菌盖纹理和颜色</li><li><strong>ITS 存在同质异型（heterogeneity）</strong>：同一个体的 ITS 拷贝间可能存在序列差异（不完全 concerted evolution）</li><li><strong>隐存种普遍</strong>：例如 <em>G. lucidum</em> 复合种实际上包含多个形态无法区分的独立物种</li><li><strong>药用价值与物种对应关系混乱</strong>：市场上&quot;野生紫灵芝&quot;&quot;黑灵芝&quot;等商品名的生物学归属长期争议</li></ul><p>因此，<strong>国际灵芝研究的主流做法是采用多基因系统发育分析</strong>（White et al., Wang et al. 等），将 ITS 作为快速筛查工具，再用 TEF1-α 和 RBP2 进行精确界定。</p><hr /><h2 id="三-硫磺菌-laetiporus-分子鉴定"><a class="markdownIt-Anchor" href="#三-硫磺菌-laetiporus-分子鉴定"></a> 三、硫磺菌 (<em>Laetiporus</em>) 分子鉴定</h2><p>硫磺菌（俗称硫黄菇、鸡肉菌）属于多孔菌目，其分子鉴定相对简单——<strong>ITS 标记即可满足绝大多数鉴定需求</strong>。</p><h3 id="31-引物列表"><a class="markdownIt-Anchor" href="#31-引物列表"></a> 3.1 引物列表</h3><table><thead><tr><th>目标基因</th><th>引物名称</th><th>序列 (5’ → 3’)</th><th>说明</th><th>预期产物</th></tr></thead><tbody><tr><td><strong>ITS</strong></td><td>ITS1</td><td><code>TCCGTAGGTGAACCTGCGG</code></td><td>真菌通用正向引物</td><td>~650-750 bp</td></tr><tr><td></td><td>ITS4</td><td><code>TCCTCCGCTTATTGATATGC</code></td><td>真菌通用反向引物</td><td></td></tr></tbody></table><blockquote><p><strong>ITS 区域</strong>：扩增产物覆盖 <strong>ITS1 – 5.8S rRNA – ITS2</strong> 完整区间，硫磺菌属 ITS 全长约 650–750 bp，是当前真菌物种鉴定的标准条形码。</p></blockquote><h3 id="32-专业补充硫磺菌的分类背景"><a class="markdownIt-Anchor" href="#32-专业补充硫磺菌的分类背景"></a> 3.2 专业补充：硫磺菌的分类背景</h3><ul><li>硫磺菌属 <em><strong>Laetiporus</strong></em> 全球分布约 20 余种，中国常见的是 <strong>硫磺菌 (<em>L. sulphureus</em>)</strong></li><li>北美有可食用的 <em><strong>L. cincinnatus</strong></em> 和有毒的 <em><strong>L. huroniensis</strong></em>（引起胃肠道不适）</li><li><strong>关键区分点</strong>：生长基质（阔叶针叶）、子实体颜色变化（鲜黄→橙红→褪色）、以及 <strong>ITS 序列中的特征性 SNP 位点</strong></li></ul><p>对于常规鉴定，单一 ITS 扩增 + BLAST 比对 NCBI GenBank 或 UNITE 数据库即可完成。</p><hr /><h2 id="四-羊肚菌-morchella-分子鉴定"><a class="markdownIt-Anchor" href="#四-羊肚菌-morchella-分子鉴定"></a> 四、羊肚菌 (<em>Morchella</em>) 分子鉴定</h2><p>羊肚菌是子囊菌门的代表类群，其分子鉴定体系最为完善，<strong>推荐使用三基因联合方案</strong>。</p><h3 id="41-引物列表"><a class="markdownIt-Anchor" href="#41-引物列表"></a> 4.1 引物列表</h3><table><thead><tr><th>目标基因</th><th>引物名称</th><th>序列 (5’ → 3’)</th><th>说明</th><th>预期产物</th></tr></thead><tbody><tr><td><strong>ITS</strong></td><td>ITS1</td><td><code>TCCGTAGGTGAACCTGCG</code></td><td>子囊菌通用</td><td>~750 bp（黑色）/ ~1,150 bp（黄色）</td></tr><tr><td></td><td>ITS4</td><td><code>TCCTCCGCTTATTGATATGC</code></td><td>—</td><td></td></tr><tr><td><strong>TEF1-α</strong></td><td>tef1F</td><td><code>TACAARTGYGGTGGTATYGACA</code></td><td>简并引物</td><td>~700-800 bp</td></tr><tr><td></td><td>tef1R</td><td><code>ACNGACTTGACYTCAGTRGT</code></td><td>—</td><td></td></tr><tr><td><strong>RPB1</strong></td><td>RPB1A</td><td><code>GARTGYCCDGGDCAYTTYGG</code></td><td>RNA聚合酶II最大亚基</td><td>~700-800 bp</td></tr><tr><td></td><td>RPB1C</td><td><code>CCNGCDATNTCRTTRTCCATRTA</code></td><td>—</td><td></td></tr><tr><td><strong>RPB2</strong></td><td>RPB2-9f</td><td><code>CAAATGGGCRATTGTCATACG</code></td><td>RNA聚合酶II第二亚基</td><td>~1,000-1,200 bp</td></tr><tr><td></td><td>RPB2-3r</td><td><code>GCATYGGTATGCAGGTTGTGG</code></td><td>—</td><td></td></tr><tr><td><strong>LSU</strong></td><td>LSU-NL1</td><td><code>GCATATCAATAAGCGGAGG</code></td><td>28S 大亚基</td><td>~600 bp</td></tr><tr><td></td><td>LSU-NL2</td><td><code>GGTCCGTGTTTCAAGACGG</code></td><td>—</td><td></td></tr></tbody></table><h3 id="42-推荐组合方案"><a class="markdownIt-Anchor" href="#42-推荐组合方案"></a> 4.2 推荐组合方案</h3><p>根据鉴定精度需求选择：</p><table><thead><tr><th>方案</th><th>基因组合</th><th>适用场景</th></tr></thead><tbody><tr><td><strong>基础方案</strong></td><td>ITS 单基因</td><td>快速筛查、市场抽检</td></tr><tr><td><strong>标准方案</strong></td><td>ITS + TEF1-α</td><td>物种级别准确鉴定</td></tr><tr><td><strong>完整方案</strong></td><td>ITS + TEF1-α + RPB1/RPB2 + LSU</td><td>分类学研究、新种描述</td></tr></tbody></table><h3 id="43-专业补充羊肚菌的系统发育复杂性"><a class="markdownIt-Anchor" href="#43-专业补充羊肚菌的系统发育复杂性"></a> 4.3 专业补充：羊肚菌的系统发育复杂性</h3><p>羊肚菌的研究经历了多次分类学革命：</p><ol><li><strong>经典形态分类时代</strong>：依据子实体形态（帽顶颜色、菌柄有无、网棱深浅）划分 ~30 个物种</li><li><strong>系统发育时代（Du et al., 2012; O’Donnell et al., 2011）</strong>：基于多基因分析将羊肚菌重新划分为 <strong>Elata Clade（黑色羊肚菌支系）</strong> 和 <strong>Esculenta Clade（黄色羊肚菌支系）</strong>，每个支系下再细分为多个系统发育谱系（phylogenetic species）</li><li><strong>当前共识</strong>：全球确认约 <strong>80+ 系统发育种</strong>（phylospecies），其中中国分布约 24+ 种</li></ol><p><strong>实用意义</strong>：</p><ul><li><strong>黑色羊肚菌（Elata Clade）</strong>：多数春季发生，价格高，但部分物种可能积累微量肼类毒素（需充分加热）</li><li><strong>黄色羊肚菌（Esculenta Clade）</strong>：包括著名的 <em><strong>M. esculenta</strong></em>（美味羊肚菌）和 <em><strong>M. deliciosa</strong></em>（美味可人羊肚菌）</li><li>不同物种的 <strong>栽培条件差异巨大</strong>（温度阈值、营养需求、休眠机制），分子鉴定对育种和栽培至关重要</li></ul><hr /><h2 id="五-数据分析与比对资源"><a class="markdownIt-Anchor" href="#五-数据分析与比对资源"></a> 五、数据分析与比对资源</h2><table><thead><tr><th>数据库</th><th>地址</th><th>特点</th></tr></thead><tbody><tr><td><strong>NCBI GenBank</strong></td><td><a href="https://www.ncbi.nlm.nih.gov/genbank/">https://www.ncbi.nlm.nih.gov/genbank/</a></td><td>最大通用核酸数据库，含注释序列</td></tr><tr><td><strong>UNITE</strong></td><td><a href="https://unite.ut.ee/">https://unite.ut.ee/</a></td><td>真菌专属 ITS 参考数据库，含物种假设（SH）</td></tr><tr><td><strong>NCBI Taxonomy</strong></td><td><a href="https://www.ncbi.nlm.nih.gov/taxonomy">https://www.ncbi.nlm.nih.gov/taxonomy</a></td><td>权威真菌分类体系参考</td></tr><tr><td><strong>MycoBank</strong></td><td><a href="https://www.mycobank.org/">https://www.mycobank.org/</a></td><td>国际真菌命名注册库</td></tr></tbody></table><blockquote><p><strong>比对建议</strong>：优先使用 <strong>UNITE</strong> 进行 ITS 序列比对（真菌专用，SH 阈值自动聚类），同时用 <strong>NCBI GenBank</strong> 交叉验证。蛋白编码基因（TEF1-α/RPB）主要依赖 GenBank。</p></blockquote><hr /><h2 id="六-注意事项"><a class="markdownIt-Anchor" href="#六-注意事项"></a> 六、注意事项</h2><h3 id="61-简并引物合成原理-设计原则与使用要点"><a class="markdownIt-Anchor" href="#61-简并引物合成原理-设计原则与使用要点"></a> 6.1 简并引物：合成原理、设计原则与使用要点</h3><p>本方案中灵芝的 TEF1-α/RPB2 引物和羊肚菌的 TEF1-α/RPB1/RPB2 引物均含有简并碱基。以下对简并引物的合成原理、设计原则及使用注意事项进行说明。</p><h4 id="合成原理"><a class="markdownIt-Anchor" href="#合成原理"></a> 合成原理</h4><p>简并引物采用固相亚磷酰胺法合成。在含简并碱基的位点，合成仪以<strong>等摩尔比例混合多种碱基单体</strong>进行偶联反应。例如在某个位点同时加入 C 和 T 单体，则该位置产出 C/T 混合物。因此最终的引物产品不是单一序列，而是一组<strong>序列相似但个别位点存在差异的引物混合物（pool）</strong>。</p><h4 id="设计原则"><a class="markdownIt-Anchor" href="#设计原则"></a> 设计原则</h4><ul><li><strong>控制简并度</strong>：总简并度应 ≤ 128（理想 ≤ 32）。简并度每增加一倍，每种特定引物的有效浓度即降低一半。例如，3 个二重简并位点 → 2³ = 8 种变体；7 个二重简并位点 → 2⁷ = 128 种变体。本方案中各简并引物的简并度约为 8–64，处于可控范围。</li><li><strong>3′端保守性</strong>：引物 3′ 端最后 5–6 个碱基应尽可能无简并，因 DNA 聚合酶从 3′ 端开始延伸，此处错配会严重降低扩增效率和特异性。</li><li><strong>密码子偏好性</strong>：在引物设计时优先选用低简并氨基酸区段（Met、Trp 各仅 1 个密码子），避开高简并区（Arg、Leu、Ser 各 6 个密码子），并根据目标物种的密码子偏好性选择高频密码子以降低整体简并度。</li></ul><h4 id="使用注意事项"><a class="markdownIt-Anchor" href="#使用注意事项"></a> 使用注意事项</h4><ol><li><strong>退火温度降低</strong>：因简并引物与模板不完全匹配，退火温度应比常规引物低 2–5°C（本方案建议 48–50°C），必要时应进行温度梯度 PCR 优化。</li><li><strong>适当提高引物浓度</strong>：由于有效浓度下降，可将引物终浓度从常规的 0.2 μM 提高至 0.4–1.0 μM，以保证每种引物变体有足够的分子参与反应。</li><li><strong>推荐 Touchdown PCR</strong>：采用递减退火温度策略（初始高于 Tm 值 3–5°C，每循环降 0.5–1°C），可有效减少简并引物在低温下的非特异性扩增。</li><li><strong>产物验证</strong>：高简并度引物的 PCR 产物建议进行克隆测序（挑取 10–20 个克隆），以确认目标序列的准确性，避免因错配导致的嵌合序列。</li><li><strong>通用碱基替代</strong>：若简并度过高，可考虑使用脱氧肌苷（dI）或 5-硝基吲哚等通用碱基替代部分简并位点，它们能与任意碱基配对，但会降低双链稳定性。</li></ol><h3 id="62-其他注意事项"><a class="markdownIt-Anchor" href="#62-其他注意事项"></a> 6.2 其他注意事项</h3><ol><li><strong>模板质量</strong>：食用菌子实体多糖含量高，CTAB 提取时需加强去除多糖步骤（增加氯仿抽提次数或使用 CTAB-PVP 缓冲液）</li><li><strong>污染防控</strong>：PCR 操作中严格分区，避免环境真菌污染（空气中有大量孢子）</li><li><strong>测序方向</strong>：双向测序（正反引物各测一条）拼接后质量更可靠</li><li><strong>命名规范</strong>：最终鉴定结果应标注使用的 <strong>基因位点</strong> 和 <strong>比对数据库版本</strong></li></ol><hr /><h2 id="参考资料"><a class="markdownIt-Anchor" href="#参考资料"></a> 参考资料</h2><ul><li>White, T.J. et al. (1990). Amplification and direct sequencing of fungal ribosomal RNA genes for phylogenetics. <em>PCR Protocols</em>, 315-322.</li><li>Schoch, C.L. et al. (2012). Nuclear ribosomal internal transcribed spacer (ITS) region as a universal DNA barcode for fungi. <em>PNAS</em>, 109(16), 6241-6246.</li><li>Du, X.H. et al. (2012). Evolutionary history of the divergent clades of the morel group (<em>Morchella</em> spp.). <em>Fungal Genetics and Biology</em>, 49, 905-918.</li><li>O’Donnell, K. et al. (2011). Phylogeny and phylogenetic nomenclature of the morel clade (<em>Morchellaceae</em>). <em>Mycologia</em>, 103(4), 777-797.</li><li>Wang, D.M. et al. (2019). Species recognition in <em>Ganoderma</em> sensu stricto. <em>Fungal Diversity</em>, 96(1), 1-36.</li></ul>]]>
    </content>
    <id>https://blog.zhengxi.me/posts/962850472/</id>
    <link href="https://blog.zhengxi.me/posts/962850472/"/>
    <published>2026-04-22T00:00:00.000Z</published>
    <summary>基于核糖体DNA（ITS/LSU）和蛋白编码基因（TEF1-α/RPB1/RPB2）的食用菌分子鉴定体系，涵盖灵芝、硫磺菌与羊肚菌的PCR引物方案。</summary>
    <title>灵芝、硫磺菌和羊肚菌的分子鉴定</title>
    <updated>2026-04-25T13:43:12.000Z</updated>
  </entry>
  <entry>
    <author>
      <name>ZhengXi</name>
    </author>
    <category term="开发笔记" scheme="https://blog.zhengxi.me/categories/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0/"/>
    <category term="微信小程序" scheme="https://blog.zhengxi.me/tags/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F/"/>
    <category term="生物信息学" scheme="https://blog.zhengxi.me/tags/%E7%94%9F%E7%89%A9%E4%BF%A1%E6%81%AF%E5%AD%A6/"/>
    <category term="科研工具" scheme="https://blog.zhengxi.me/tags/%E7%A7%91%E7%A0%94%E5%B7%A5%E5%85%B7/"/>
    <category term="实验计算" scheme="https://blog.zhengxi.me/tags/%E5%AE%9E%E9%AA%8C%E8%AE%A1%E7%AE%97/"/>
    <content>
      <![CDATA[<blockquote><p><strong>生科小算 Pro</strong> — 一站式分子生物学科研计算工具箱</p></blockquote><h2 id="biocpng"><a class="markdownIt-Anchor" href="#biocpng"></a> <img src="https://i.see.you/2026/04/21/w5eW/bioc.png" alt="bioc.png" /></h2><h2 id="项目简介-project-introduction"><a class="markdownIt-Anchor" href="#项目简介-project-introduction"></a> 项目简介 | Project Introduction</h2><p><strong>生科小算 Pro</strong> 是一款专为生命科学领域科研人员打造的微信小程序工具集。它将日常实验中频繁使用的各类计算功能整合到一个简洁优雅的应用中，帮助研究者从繁琐的手工计算中解放出来，专注于科学发现本身。</p><p>从 DNA 序列分析到细胞培养方案设计，从 PCR 体系配制到动物实验剂量计算——22 个精心设计的工具模块覆盖了分子生物学、细胞生物学和基础药理学的常见计算需求。</p><h3 id="设计理念"><a class="markdownIt-Anchor" href="#设计理念"></a> 设计理念</h3><ul><li><strong>精准可靠</strong>：所有计算公式均来自权威文献或教科书，确保结果可溯源</li><li><strong>薄荷清新</strong>：采用薄荷绿主色调（<code>#3ecec4</code>），缓解实验疲劳感</li><li><strong>即用即走</strong>：无需注册登录，打开即用，适配碎片化实验时间</li><li><strong>每日激励</strong>：首页展示科研励志语录，陪伴每一个熬夜做实验的日子</li></ul><hr /><h2 id="功能矩阵-feature-matrix"><a class="markdownIt-Anchor" href="#功能矩阵-feature-matrix"></a> 功能矩阵 | Feature Matrix</h2><h3 id="核心计算工具-core-calculators"><a class="markdownIt-Anchor" href="#核心计算工具-core-calculators"></a> 核心计算工具 (Core Calculators)</h3><table><thead><tr><th>工具名称</th><th>功能描述</th><th>典型场景</th></tr></thead><tbody><tr><td><strong>溶液配制计算</strong></td><td>摩尔浓度、质量摩尔浓度、百分比浓度、稀释倍数计算</td><td>缓冲液配制、标准溶液制备</td></tr><tr><td><strong>DNA/RNA 计算</strong></td><td>核酸序列分子量、Tm 值（熔解温度）、GC 含量、OD260 浓度换算</td><td>引物设计验证、核酸定量</td></tr><tr><td><strong>蛋白质定量计算</strong></td><td>蛋白质分子量、氨基酸组成分析、等电点 pI 预测、三字母/单字母缩写互查</td><td>蛋白质表征分析</td></tr><tr><td><strong>PCR 相关计算</strong></td><td>PCR 反应体系配制、产物量预测、引物浓度计算</td><td>分子克隆实验准备</td></tr><tr><td><strong>qPCR 定量计算</strong></td><td>实时荧光定量 PCR 数据分析、ΔΔCt 法基因表达量计算、相对定量</td><td>基因表达差异分析</td></tr><tr><td><strong>分子式分子量计算</strong></td><td>输入化学分子式自动解析并计算分子量，支持水合分子</td><td>化学品称量计算</td></tr><tr><td><strong>质粒连接构建</strong></td><td>载体:插入片段摩尔比计算、T4 连接酶体系用量、连接反应效率评估</td><td>分子克隆连接反应</td></tr></tbody></table><h3 id="细胞生物学工具-cell-biology-tools"><a class="markdownIt-Anchor" href="#细胞生物学工具-cell-biology-tools"></a> 细胞生物学工具 (Cell Biology Tools)</h3><table><thead><tr><th>工具名称</th><th>功能描述</th><th>典型场景</th></tr></thead><tbody><tr><td><strong>细胞铺板计算</strong></td><td>计算每孔所需细胞数与培养液体积，支持 6/12/24/48/96/384 孔板规格</td><td>细胞接种方案设计</td></tr><tr><td><strong>细胞稀释计算</strong></td><td>细胞悬液稀释所需原液体积与稀释剂体积计算</td><td>调整至目标细胞密度</td></tr><tr><td><strong>细胞计数计算</strong></td><td>血球计数板（血球计数法）细胞浓度计算，支持大格/小格计数模式</td><td>手动细胞计数后浓度核算</td></tr><tr><td><strong>增殖速率模拟</strong></td><td>基于指数增长模型模拟细胞数量随时间变化趋势，可视化生长曲线</td><td>预测细胞汇合时间</td></tr><tr><td><strong>细胞增殖时间计算</strong></td><td>根据初始/终末细胞数及培养时长，计算群体倍增时间 (PDT)</td><td>评估细胞生长状态</td></tr><tr><td><strong>冻存配方计算</strong></td><td>细胞冻存液中 DMSO/培养基的精确配比计算，支持多种冻存体系</td><td>细胞库建立</td></tr></tbody></table><h3 id="动物实验工具-animal-experiment-tools"><a class="markdownIt-Anchor" href="#动物实验工具-animal-experiment-tools"></a> 动物实验工具 (Animal Experiment Tools)</h3><table><thead><tr><th>工具名称</th><th>功能描述</th><th>典型场景</th></tr></thead><tbody><tr><td><strong>动物给药方案计算器</strong></td><td>基于体重/体表面积的给药剂量计算、注射溶液配制</td><td>小鼠/大鼠给药实验</td></tr><tr><td><strong>动物体表面积计算</strong></td><td>基于 Meeh-Rubner 公式计算实验动物体表面积 (BSA)</td><td>给药剂量归一化</td></tr><tr><td><strong>物种年龄换算器</strong></td><td>跨物种等效年龄转换（人/小鼠/大鼠等），基于物种特异性寿命模型</td><td>动物模型年龄对应</td></tr><tr><td><strong>细菌生长时间预估</strong></td><td>通过 OD600 光密度值预估细菌生长阶段及培养时间</td><td>优化菌体收获时机</td></tr></tbody></table><h3 id="实验辅助工具-lab-assistants"><a class="markdownIt-Anchor" href="#实验辅助工具-lab-assistants"></a> 实验辅助工具 (Lab Assistants)</h3><table><thead><tr><th>工具名称</th><th>功能描述</th></tr></thead><tbody><tr><td><strong>实验工具箱</strong></td><td>离心机 RCF/RPM 换算、OD 值单位转换、多类型通用单位换算</td></tr><tr><td><strong>通用引物查询</strong></td><td>快速查询常用载体引物序列（如 T7/SP6/M13 等）及测序引物信息</td></tr><tr><td><strong>多计时器</strong></td><td>同时管理多个倒计时/正计时，适用于酶切、电泳、孵育等多步实验流程</td></tr><tr><td><strong>计数器</strong></td><td>点击式简单计数器，支持历史记录保存（如手动细胞计数、菌落计数）</td></tr><tr><td><strong>数据管理</strong></td><td>本地存储实验记录与计算结果，便于后续查阅和数据追溯</td></tr></tbody></table><hr /><h2 id="技术架构-technical-architecture"><a class="markdownIt-Anchor" href="#技术架构-technical-architecture"></a> 技术架构 | Technical Architecture</h2><pre><code>生科小算Pro/├── app.js                    # 应用入口，全局配置├── app.json                  # 页面路由 &amp; 窗口配置（26 个页面）├── app.wxss                 # 全局样式（薄荷绿主题变量）├── pages/│   ├── index/               # 首页（工具导航 + 每日语录轮播）│   ├── *-calculator/        # 各类计算工具页面（22 个）│   ├── feedback/            # 用户反馈入口│   └── data-manager/        # 数据持久化管理├── utils/│   ├── util.js              # 通用工具函数│   └── format-util.wxs      # WXS 数据格式化滤镜├── images/                  # 22 枚 SVG 扁平化图标└── i18n/                   # 国际化资源（预留）</code></pre><h3 id="技术要点"><a class="markdownIt-Anchor" href="#技术要点"></a> 技术要点</h3><ul><li><strong>原生框架</strong>：微信小程序 WXML / WXSS / JS 三件套，无第三方 UI 库依赖</li><li><strong>样式系统</strong>：基于 CSS 自定义属性 (<code>--primary-color</code>) 的主题变量系统，全局统一薄荷绿配色</li><li><strong>图标方案</strong>：全部采用自绘 SVG 矢量图标（64×64 viewBox），现代扁平线条风格</li><li><strong>数据持久化</strong>：<code>wx.setStorageSync</code> 本地存储，支持计算历史与用户偏好保留</li><li><strong>性能优化</strong>：<code>requiredComponents</code> 懒加载 + 页面预加载规则配置</li></ul><hr /><h2 id="后续更新方向-future-roadmap"><a class="markdownIt-Anchor" href="#后续更新方向-future-roadmap"></a> 后续更新方向 | Future Roadmap</h2><h3 id="近期计划-near-term"><a class="markdownIt-Anchor" href="#近期计划-near-term"></a> 近期计划 (Near-term)</h3><ul><li><p><strong>引物设计与优化</strong></p><ul><li>引物 Tm 值优化、发卡结构/二聚体检测</li><li>限制性内切酶位点扫描</li><li>与 NCBI BLAST 结果联动</li></ul></li><li><p><strong>凝胶电泳分析</strong></p><ul><li>DNA Marker 片段大小估算</li><li>电泳条带迁移距离和分子量换算</li></ul></li><li><p><strong>数据导出增强</strong></p><ul><li>计算结果一键生成 CSV / PDF 实验报告</li><li>支持批量导出历史记录</li></ul></li></ul><h3 id="中期规划-mid-term"><a class="markdownIt-Anchor" href="#中期规划-mid-term"></a> 中期规划 (Mid-term)</h3><ul><li><strong>实验流程向导</strong><ul><li>Western Blot 全流程计算（上样量→转膜条件→抗体稀释→显影时间）</li><li>细胞转染方案设计（脂质体/电转参数推荐）</li></ul></li></ul><h3 id="远期展望-long-term"><a class="markdownIt-Anchor" href="#远期展望-long-term"></a> 远期展望 (Long-term)</h3><ul><li><p><strong>AI 辅助功能</strong></p><ul><li>基于用户输入的自然语言实验需求，智能推荐合适工具与参数</li><li>异常数值自动预警（如超出合理范围的结果高亮提示）</li></ul></li><li><p><strong>HarmonyOS NEXT 版本</strong></p><ul><li>基于 ArkTS 的原生鸿蒙应用已同步开发中</li><li>跨平台统一用户体验</li></ul></li></ul><hr /><h2 id="反馈与联系-feedback"><a class="markdownIt-Anchor" href="#反馈与联系-feedback"></a> 反馈与联系 | Feedback</h2><p>在使用过程中遇到任何问题或有新功能建议，欢迎通过以下方式联系：</p><ul><li><strong>微信</strong>：<code>realzhengxi</code></li><li><strong>社交平台</strong>：小红书 / 抖音搜索「<strong>生科小算Pro</strong>」</li><li><strong>小程序内反馈</strong>：首页 → 右上角 → 反馈按钮</li></ul><hr /><blockquote><p><strong>本文最后更新于</strong>：2026-04-21<br /><strong>适用版本</strong>：生科小算 Pro v9.x<br /><strong>声明</strong>：本工具仅供辅助参考，实际实验操作请以实验室 SOP 为准。</p></blockquote><hr /><h2 id="相关链接-links"><a class="markdownIt-Anchor" href="#相关链接-links"></a> 相关链接 | Links</h2><ul><li>[微信小程序搜索「生科小算Pro」</li><li><a href="#">配套鸿蒙版 · 生科小算</a> （开发中）</li><li><a href="#">生科Protocols</a> （合作伙伴）</li></ul><hr /><p><em>用计算的力量，加速每一次发现的脚步。</em></p>]]>
    </content>
    <id>https://blog.zhengxi.me/posts/3215020490/</id>
    <link href="https://blog.zhengxi.me/posts/3215020490/"/>
    <published>2026-04-21T00:00:00.000Z</published>
    <summary>生科小算Pro：一站式分子生物学科研计算工具箱。</summary>
    <title>微信小程序：生科小算Pro</title>
    <updated>2026-04-23T09:16:02.000Z</updated>
  </entry>
  <entry>
    <author>
      <name>ZhengXi</name>
    </author>
    <category term="开发笔记" scheme="https://blog.zhengxi.me/categories/%E5%BC%80%E5%8F%91%E7%AC%94%E8%AE%B0/"/>
    <category term="微信小程序" scheme="https://blog.zhengxi.me/tags/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F/"/>
    <category term="Git" scheme="https://blog.zhengxi.me/tags/Git/"/>
    <category term="GitHub" scheme="https://blog.zhengxi.me/tags/GitHub/"/>
    <category term="SSH" scheme="https://blog.zhengxi.me/tags/SSH/"/>
    <category term="微信开发者工具" scheme="https://blog.zhengxi.me/tags/%E5%BE%AE%E4%BF%A1%E5%BC%80%E5%8F%91%E8%80%85%E5%B7%A5%E5%85%B7/"/>
    <content>
      <![CDATA[<h2 id="概述"><a class="markdownIt-Anchor" href="#概述"></a> 概述</h2><p>在微信开发者工具中，通过 Git 版本管理将小程序项目推送到 GitHub 远程仓库，需要完成 <strong>SSH 密钥配置</strong> 和 <strong>远程仓库设置</strong> 两个核心步骤。</p><blockquote><p><strong>推荐认证方式</strong>：使用 <strong>SSH Key（指定密钥）</strong> 方式认证，比 SSH Agent 更可靠，不依赖系统 ssh-agent 进程。</p></blockquote><hr /><h2 id="一-生成-ssh-密钥对"><a class="markdownIt-Anchor" href="#一-生成-ssh-密钥对"></a> 一、生成 SSH 密钥对</h2><p>打开终端（Terminal），执行以下命令：</p><pre><code class="bash">ssh-keygen -t ed25519 -C &quot;你的GitHub邮箱@example.com&quot;</code></pre><p>按提示操作：</p><ul><li><strong>文件保存路径</strong>：直接回车，使用默认路径 <code>~/.ssh/id_ed25519</code></li><li><strong>密码短语 (passphrase)</strong>：可设置也可留空</li></ul><blockquote><p><strong>为什么用 ed25519？</strong> <code>ed25519</code> 是 GitHub 推荐的最新算法，比传统的 <code>rsa</code> 更安全、更快。如果系统不支持，可改用 <code>ssh-keygen -t rsa -b 4096</code>。</p></blockquote><p>生成后会在 <code>~/.ssh/</code> 目录下产生两个文件：</p><table><thead><tr><th>文件</th><th>说明</th></tr></thead><tbody><tr><td><code>id_ed25519</code></td><td>私钥（<mark>绝对不能泄露</mark>）</td></tr><tr><td><code>id_ed25519.pub</code></td><td>公钥（添加到 GitHub 使用）</td></tr></tbody></table><hr /><h2 id="二-将公钥添加到-github"><a class="markdownIt-Anchor" href="#二-将公钥添加到-github"></a> 二、将公钥添加到 GitHub</h2><h3 id="21-查看并复制公钥"><a class="markdownIt-Anchor" href="#21-查看并复制公钥"></a> 2.1 查看并复制公钥</h3><pre><code class="bash">cat ~/.ssh/id_ed25519.pub</code></pre><p>复制输出的全部内容。</p><h3 id="22-在-github-上添加"><a class="markdownIt-Anchor" href="#22-在-github-上添加"></a> 2.2 在 GitHub 上添加</h3><ol><li>打开 GitHub → <strong>Settings</strong> → <strong>SSH and GPG keys</strong> → <strong>New SSH key</strong></li><li><strong>Title</strong>：随意填写（如 <code>WeChat DevTools</code>）</li><li><strong>Key type</strong>：选择 <code>Authentication Key</code></li><li><strong>Key</strong>：粘贴刚才复制的公钥内容</li><li>点击 <strong>Add SSH key</strong></li></ol><hr /><h2 id="三-配置-~sshconfig推荐"><a class="markdownIt-Anchor" href="#三-配置-~sshconfig推荐"></a> 三、配置 ~/.ssh/config（推荐）</h2><h3 id="31-创建或编辑-config-文件"><a class="markdownIt-Anchor" href="#31-创建或编辑-config-文件"></a> 3.1 创建或编辑 config 文件</h3><pre><code class="bash">nano ~/.ssh/config</code></pre><h3 id="32-写入以下内容"><a class="markdownIt-Anchor" href="#32-写入以下内容"></a> 3.2 写入以下内容</h3><pre><code># ===== GitHub 配置 =====Host github.com  HostName github.com  User git  IdentityFile ~/.ssh/id_ed25519  UseKeychain yes    # 仅 macOS 需要，Windows/Linux 删掉这行</code></pre><h3 id="33-设置文件权限"><a class="markdownIt-Anchor" href="#33-设置文件权限"></a> 3.3 设置文件权限</h3><pre><code class="bash">chmod 600 ~/.ssh/config</code></pre><blockquote><p><strong>权限必须为 600</strong>：SSH 要求 config 文件权限必须是 <code>600</code>（仅所有者可读写），否则会报错 <code>Bad owner or permissions</code>。</p></blockquote><h3 id="34-逐行解释"><a class="markdownIt-Anchor" href="#34-逐行解释"></a> 3.4 逐行解释</h3><table><thead><tr><th>配置项</th><th>含义</th></tr></thead><tbody><tr><td><code>Host github.com</code></td><td>匹配规则：当连接 <code>github.com</code> 时触发以下配置</td></tr><tr><td><code>HostName github.com</code></td><td>实际连接的主机地址</td></tr><tr><td><code>User git</code></td><td>使用 <code>git</code> 用户身份连接（GitHub 固定为 git）</td></tr><tr><td><code>IdentityFile ~/.ssh/id_ed25519</code></td><td>指定使用的私钥文件路径</td></tr><tr><td><code>UseKeychain yes</code></td><td>macOS 专用：将密钥存入系统钥匙串，重启后自动加载</td></tr></tbody></table><h3 id="35-多平台多账号配置进阶"><a class="markdownIt-Anchor" href="#35-多平台多账号配置进阶"></a> 3.5 多平台/多账号配置（进阶）</h3><pre><code># ===== GitHub 主账号 =====Host github.com  HostName github.com  User git  IdentityFile ~/.ssh/id_ed25519_github  UseKeychain yes# ===== Gitee =====Host gitee.com  HostName gitee.com  User git  IdentityFile ~/.ssh/id_ed25519_gitee  UseKeychain yes# ===== GitHub 副账号（通过别名区分）=====Host github-work  HostName github.com  User git  IdentityFile ~/.ssh/id_ed25519_work  UseKeychain yes</code></pre><p>使用副账号时，克隆地址中的 <code>github.com</code> 替换为别名：</p><pre><code class="bash">git clone git@github-work:workuser/repo.git</code></pre><hr /><h2 id="四-测试-ssh-连接"><a class="markdownIt-Anchor" href="#四-测试-ssh-连接"></a> 四、测试 SSH 连接</h2><pre><code class="bash">ssh -T git@github.com</code></pre><p>首次连接会提示确认 GitHub 指纹，输入 <code>yes</code>。</p><ul><li>成功输出：<code>Hi 你的用户名! You've successfully authenticated, but GitHub does not provide shell access.</code></li><li>失败输出：<code>Permission denied (publickey)</code> → 检查公钥是否正确添加到 GitHub</li></ul><hr /><h2 id="五-微信开发者工具配置"><a class="markdownIt-Anchor" href="#五-微信开发者工具配置"></a> 五、微信开发者工具配置</h2><h3 id="51-配置认证方式"><a class="markdownIt-Anchor" href="#51-配置认证方式"></a> 5.1 配置认证方式</h3><p>进入 <strong>版本管理</strong> → <strong>设置</strong>（齿轮图标）→ <strong>网络和认证</strong> → <strong>认证方式</strong>：</p><p>选择 <strong>使用 SSH Key（指定密钥）</strong>：</p><table><thead><tr><th>字段</th><th>应填写的路径</th></tr></thead><tbody><tr><td><strong>公钥文件</strong></td><td><code>/Users/你的用户名/.ssh/id_ed25519.pub</code></td></tr><tr><td><strong>私钥文件</strong></td><td><code>/Users/你的用户名/.ssh/id_ed25519</code></td></tr><tr><td><strong>密码短语</strong></td><td>生成密钥时设置的密码，没设置就留空</td></tr></tbody></table><blockquote><p><strong>公钥 vs 私钥路径</strong></p><ul><li>公钥文件路径末尾必须有 <strong><code>.pub</code></strong></li><li>私钥文件路径<strong>没有</strong> <code>.pub</code></li><li>混淆两者会导致 <code>SSH Public key file not found</code> 错误</li></ul></blockquote><h3 id="52-配置远程仓库"><a class="markdownIt-Anchor" href="#52-配置远程仓库"></a> 5.2 配置远程仓库</h3><p>进入 <strong>版本管理</strong> → <strong>远程</strong> 标签 → <strong>添加远程仓库</strong>：</p><table><thead><tr><th>字段</th><th>值</th></tr></thead><tbody><tr><td><strong>名称</strong></td><td><code>origin</code></td></tr><tr><td><strong>URL</strong></td><td><code>git@github.com:你的用户名/仓库名.git</code></td></tr></tbody></table><blockquote><p><strong>SSH URL 格式</strong>：GitHub SSH 地址格式为 <code>git@github.com:用户名/仓库名.git</code>，不要使用 HTTPS 格式（<code>https://github.com/...</code>）。</p></blockquote><h3 id="53-推送"><a class="markdownIt-Anchor" href="#53-推送"></a> 5.3 推送</h3><p>点击 <strong>推送</strong>，选择本地分支和远程分支，确认即可。</p><hr /><h2 id="六-常见问题排查"><a class="markdownIt-Anchor" href="#六-常见问题排查"></a> 六、常见问题排查</h2><h3 id="61-错误速查表"><a class="markdownIt-Anchor" href="#61-错误速查表"></a> 6.1 错误速查表</h3><table><thead><tr><th>错误信息</th><th>原因</th><th>解决方案</th></tr></thead><tbody><tr><td><code>Permission denied (publickey)</code></td><td>公钥未添加到 GitHub 或密钥不匹配</td><td>重新检查 <a href="#%E4%BA%8C%E5%B0%86%E5%85%AC%E9%92%A5%E6%B7%BB%E5%8A%A0%E5%88%B0-github">第二步</a></td></tr><tr><td><code>SSH Public key file not found</code></td><td>微信工具中公钥路径填错</td><td>确保公钥路径以 <code>.pub</code> 结尾</td></tr><tr><td><code>credentials callback max loop reached</code></td><td>认证方式配置不当</td><td>改用「指定密钥」而非「SSH Agent」</td></tr><tr><td><code>Bad owner or permissions</code></td><td>config 文件权限过宽</td><td>执行 <code>chmod 600 ~/.ssh/config</code></td></tr><tr><td><code>Could not open a connection to your authentication agent</code></td><td>ssh-agent 未启动</td><td>执行 <code>eval &quot;$(ssh-agent -s)&quot;</code></td></tr><tr><td>macOS 重启后需重新 ssh-add</td><td>未配置 UseKeychain</td><td>确保 config 中有 <code>UseKeychain yes</code>，然后执行 <code>ssh-add --apple-use-keychain ~/.ssh/id_ed25519</code></td></tr></tbody></table><h3 id="62-新建空仓库能否推送"><a class="markdownIt-Anchor" href="#62-新建空仓库能否推送"></a> 6.2 新建空仓库能否推送？</h3><blockquote><p><strong>Q：远程仓库是新建的空仓库，能推送吗？</strong></p><p><strong>A：完全可以。</strong> 新建的空仓库没有任何提交记录，直接推送本地分支即可。GitHub 会在首次推送时自动创建对应的远程分支。</p></blockquote><h3 id="63-nano-编辑器快捷键"><a class="markdownIt-Anchor" href="#63-nano-编辑器快捷键"></a> 6.3 nano 编辑器快捷键</h3><table><thead><tr><th>快捷键</th><th>功能</th></tr></thead><tbody><tr><td><code>Ctrl+O</code></td><td>保存文件（WriteOut）</td></tr><tr><td><code>Enter</code></td><td>确认文件名</td></tr><tr><td><code>Ctrl+X</code></td><td>退出 nano</td></tr><tr><td><code>Ctrl+C</code></td><td>取消当前操作</td></tr><tr><td><code>Ctrl+G</code></td><td>查看帮助</td></tr></tbody></table><hr /><h2 id="七-完整操作流程图"><a class="markdownIt-Anchor" href="#七-完整操作流程图"></a> 七、完整操作流程图</h2><p><img src="https://i.see.you/2026/04/22/8ejZ/_20260422190301_401_34.png" alt="微信图片_20260422190301_401_34.png" /></p><hr /><h2 id="参考资料"><a class="markdownIt-Anchor" href="#参考资料"></a> 参考资料</h2><ul><li><a href="https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent">GitHub 官方 SSH 密钥生成文档</a></li><li><a href="https://docs.github.com/zh/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection">GitHub 官方 SSH 配置文档</a></li></ul>]]>
    </content>
    <id>https://blog.zhengxi.me/posts/3792786316/</id>
    <link href="https://blog.zhengxi.me/posts/3792786316/"/>
    <published>2026-04-20T00:00:00.000Z</published>
    <summary>通过 Git 版本管理将小程序项目推送到 GitHub 远程仓库。</summary>
    <title>微信小程序Git远程仓库设置（GitHub）</title>
    <updated>2026-04-23T09:16:02.000Z</updated>
  </entry>
</feed>
