<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>DJuR</title>
    <description>DJuR blog.
</description>
    <link>https://DJuR.github.io/</link>
    <atom:link href="https://DJuR.github.io/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Fri, 06 Feb 2026 05:56:42 +0000</pubDate>
    <lastBuildDate>Fri, 06 Feb 2026 05:56:42 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Git 使用与配置全指南</title>
        <description>&lt;h1 id=&quot;git-使用与配置全指南&quot;&gt;Git 使用与配置全指南&lt;/h1&gt;

&lt;blockquote&gt;
  &lt;p&gt;本文记录 Git 常用配置、项目级与全局配置、代理设置、缓存清理、多账户管理以及基本 rebase 使用。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;目录&quot;&gt;目录&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#1-git-配置概览&quot;&gt;1. Git 配置概览&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#2-git-配置等级&quot;&gt;2. Git 配置等级&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#3-查看当前配置&quot;&gt;3. 查看当前配置&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#4-用户信息配置&quot;&gt;4. 用户信息配置&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#5-代理配置&quot;&gt;5. 代理配置&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#6-常用-git-配置项&quot;&gt;6. 常用 Git 配置项&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#7-配置文件说明&quot;&gt;7. 配置文件说明&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#8-git-缓存管理&quot;&gt;8. Git 缓存管理&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#9-多账户-ssh--https-切换&quot;&gt;9. 多账户 SSH / HTTPS 切换&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#10-基本-rebase-使用与作用&quot;&gt;10. 基本 rebase 使用与作用&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#11-实战技巧&quot;&gt;11. 实战技巧&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;1-git-配置概览&quot;&gt;1. Git 配置概览&lt;/h2&gt;

&lt;p&gt;Git 配置用于定义 Git 行为和操作习惯，可以影响 commit、push、pull 等操作。
主要配置文件：&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;配置等级&lt;/th&gt;
      &lt;th&gt;配置文件位置&lt;/th&gt;
      &lt;th&gt;作用范围&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;系统级&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/gitconfig&lt;/code&gt; (Linux/Mac) &lt;br /&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C:\ProgramData\Git\config&lt;/code&gt; (Windows)&lt;/td&gt;
      &lt;td&gt;对系统所有用户生效&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;全局级&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.gitconfig&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.config/git/config&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;对当前用户生效&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;仓库级&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.git/config&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;对当前 Git 仓库生效&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;blockquote&gt;
  &lt;p&gt;配置优先级：&lt;strong&gt;仓库级 &amp;gt; 用户级 &amp;gt; 系统级&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;2-git-配置等级&quot;&gt;2. Git 配置等级&lt;/h2&gt;

&lt;h3 id=&quot;系统级配置&quot;&gt;系统级配置&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--system&lt;/span&gt; user.name &lt;span class=&quot;s2&quot;&gt;&quot;SystemUser&quot;&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--system&lt;/span&gt; user.email &lt;span class=&quot;s2&quot;&gt;&quot;system@example.com&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;系统级配置需要管理员权限。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;用户全局配置&quot;&gt;用户/全局配置&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; user.name &lt;span class=&quot;s2&quot;&gt;&quot;YourName&quot;&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; user.email &lt;span class=&quot;s2&quot;&gt;&quot;you@example.com&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;仓库级配置&quot;&gt;仓库级配置&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; /path/to/your/repo
git config user.name &lt;span class=&quot;s2&quot;&gt;&quot;ProjectUser&quot;&lt;/span&gt;
git config user.email &lt;span class=&quot;s2&quot;&gt;&quot;project@example.com&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;仓库级配置会覆盖全局配置。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;3-查看当前配置&quot;&gt;3. 查看当前配置&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 查看全部配置&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 查看特定配置&lt;/span&gt;
git config user.name
git config &lt;span class=&quot;nt&quot;&gt;--get&lt;/span&gt; user.email

&lt;span class=&quot;c&quot;&gt;# 查看各级别配置&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--system&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--local&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 查看配置来源&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;-l&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--show-origin&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;4-用户信息配置&quot;&gt;4. 用户信息配置&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; user.name &lt;span class=&quot;s2&quot;&gt;&quot;DJUR&quot;&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; user.email &lt;span class=&quot;s2&quot;&gt;&quot;djur@example.com&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;验证：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# 输出：&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# user.name=DJUR&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# user.email=djur@example.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;5-代理配置&quot;&gt;5. 代理配置&lt;/h2&gt;

&lt;h3 id=&quot;http--https-代理&quot;&gt;HTTP / HTTPS 代理&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; http.proxy http://127.0.0.1:7890
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; https.proxy http://127.0.0.1:7890
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;socks5-代理&quot;&gt;SOCKS5 代理&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; http.proxy &lt;span class=&quot;s1&quot;&gt;&apos;socks5://127.0.0.1:1080&apos;&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; https.proxy &lt;span class=&quot;s1&quot;&gt;&apos;socks5://127.0.0.1:1080&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;取消代理&quot;&gt;取消代理&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--unset&lt;/span&gt; http.proxy
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--unset&lt;/span&gt; https.proxy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;6-常用-git-配置项&quot;&gt;6. 常用 Git 配置项&lt;/h2&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 编辑器&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; core.editor &lt;span class=&quot;s2&quot;&gt;&quot;code --wait&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 差异显示颜色&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; color.ui auto

&lt;span class=&quot;c&quot;&gt;# 默认分支名&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; init.defaultBranch main

&lt;span class=&quot;c&quot;&gt;# 合并冲突显示方式&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; merge.conflictstyle diff3

&lt;span class=&quot;c&quot;&gt;# 缓存 HTTPS 凭证&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; credential.helper cache &lt;span class=&quot;nt&quot;&gt;--timeout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;3600

&lt;span class=&quot;c&quot;&gt;# 拉取策略&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; pull.rebase &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;      &lt;span class=&quot;c&quot;&gt;# merge 默认&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--global&lt;/span&gt; pull.ff only           &lt;span class=&quot;c&quot;&gt;# 快进&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;7-配置文件说明&quot;&gt;7. 配置文件说明&lt;/h2&gt;

&lt;div class=&quot;language-ini highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;[user]&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;DJUR&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;email&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;djur@example.com&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;[core]&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;editor&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;code --wait&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;autocrlf&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;input&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;[color]&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;ui&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;auto&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;[http]&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;proxy&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;http://127.0.0.1:7890&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;[credential]&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;helper&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;cache --timeout=3600&lt;/span&gt;
&lt;span class=&quot;nn&quot;&gt;[init]&lt;/span&gt;
    &lt;span class=&quot;py&quot;&gt;defaultBranch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;main&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;8-git-缓存管理&quot;&gt;8. Git 缓存管理&lt;/h2&gt;

&lt;h3 id=&quot;移除已缓存的文件--清理缓存&quot;&gt;移除已缓存的文件 / 清理缓存&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 移除已缓存但未提交的文件&lt;/span&gt;
git &lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--cached&lt;/span&gt; &amp;lt;file&amp;gt;

&lt;span class=&quot;c&quot;&gt;# 移除所有缓存文件（例如 .gitignore 生效）&lt;/span&gt;
git &lt;span class=&quot;nb&quot;&gt;rm&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--cached&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
git add &lt;span class=&quot;nb&quot;&gt;.&lt;/span&gt;
git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Apply .gitignore&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;清理凭证缓存&quot;&gt;清理凭证缓存&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git credential-cache &lt;span class=&quot;nb&quot;&gt;exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;9-多账户-ssh--https-切换&quot;&gt;9. 多账户 SSH / HTTPS 切换&lt;/h2&gt;

&lt;h3 id=&quot;1-ssh-多账户配置&quot;&gt;1. SSH 多账户配置&lt;/h3&gt;

&lt;p&gt;编辑 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.ssh/config&lt;/code&gt;：&lt;/p&gt;

&lt;div class=&quot;language-ssh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# GitHub 个人账号&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;Host&lt;/span&gt; github-personal
    &lt;span class=&quot;k&quot;&gt;HostName&lt;/span&gt; github.com
    &lt;span class=&quot;k&quot;&gt;User&lt;/span&gt; git
    &lt;span class=&quot;k&quot;&gt;IdentityFile&lt;/span&gt; ~/.ssh/id_rsa_personal

&lt;span class=&quot;c1&quot;&gt;# GitHub 工作账号&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;Host&lt;/span&gt; github-work
    &lt;span class=&quot;k&quot;&gt;HostName&lt;/span&gt; github.com
    &lt;span class=&quot;k&quot;&gt;User&lt;/span&gt; git
    &lt;span class=&quot;k&quot;&gt;IdentityFile&lt;/span&gt; ~/.ssh/id_rsa_work
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;克隆仓库时使用别名：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone git@github-personal:username/repo.git
git clone git@github-work:company/repo.git
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2-https-多账户凭证缓存&quot;&gt;2. HTTPS 多账户（凭证缓存）&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 针对仓库设置不同用户&lt;/span&gt;
git config user.name &lt;span class=&quot;s2&quot;&gt;&quot;WorkUser&quot;&lt;/span&gt;
git config user.email &lt;span class=&quot;s2&quot;&gt;&quot;work@example.com&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 使用 credential helper 保存不同账户密码&lt;/span&gt;
git config credential.helper store
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;10-基本-rebase-使用与作用&quot;&gt;10. 基本 rebase 使用与作用&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rebase&lt;/code&gt; 用于将分支修改“移动”到另一分支的最前端，保持提交历史线性。&lt;/p&gt;

&lt;h3 id=&quot;1-交互式-rebase&quot;&gt;1. 交互式 rebase&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 修改最近 3 次提交&lt;/span&gt;
git rebase &lt;span class=&quot;nt&quot;&gt;-i&lt;/span&gt; HEAD~3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;可用于合并提交、修改提交信息、删除提交。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;2-将分支更新到主分支&quot;&gt;2. 将分支更新到主分支&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 切到 feature 分支&lt;/span&gt;
git checkout feature

&lt;span class=&quot;c&quot;&gt;# 将 main 分支的最新提交移动到 feature 前端&lt;/span&gt;
git rebase main
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3-使用注意事项&quot;&gt;3. 使用注意事项&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;已推送到远程的分支尽量不要 rebase，会破坏公共历史&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;rebase 后若出现冲突，手动解决冲突并执行：&lt;/p&gt;

    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git rebase &lt;span class=&quot;nt&quot;&gt;--continue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;放弃 rebase：&lt;/p&gt;

    &lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git rebase &lt;span class=&quot;nt&quot;&gt;--abort&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;11-实战技巧&quot;&gt;11. 实战技巧&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;多账户管理&lt;/strong&gt;&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;仓库级配置 + SSH 配置，实现个人/工作账号切换。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;代理自动切换&lt;/strong&gt;&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;脚本检测网络环境，自动配置代理。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;配置优先级检查&lt;/strong&gt;&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git config -l --show-origin&lt;/code&gt; 查看每条配置来源。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;缓存与 .gitignore 生效&lt;/strong&gt;&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git rm -r --cached .&lt;/code&gt; 配合 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.gitignore&lt;/code&gt; 清理无效文件。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;保持提交历史整洁&lt;/strong&gt;&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;使用 rebase 合并小提交，保证线性历史。&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;hr /&gt;

&lt;blockquote&gt;
  &lt;p&gt;掌握 Git 配置、代理、多账户管理及 rebase 技巧，可以让开发者在多环境、多项目中高效协作，避免常见的冲突和身份混乱问题。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;p&gt;如果你愿意，我可以帮你加一段 &lt;strong&gt;“一键初始化新项目 Git 高级配置脚本”&lt;/strong&gt;，让你新建项目时自动应用全局、仓库级配置、代理、多账户 SSH、默认分支和基本 rebase 策略，一行命令就能搞定，非常适合技术博客附带示例。&lt;/p&gt;

&lt;p&gt;你希望我加吗？&lt;/p&gt;
</description>
        <pubDate>Fri, 06 Feb 2026 00:00:00 +0000</pubDate>
        <link>https://DJuR.github.io/%E5%B7%A5%E5%85%B7/git-use-config.html</link>
        <guid isPermaLink="true">https://DJuR.github.io/%E5%B7%A5%E5%85%B7/git-use-config.html</guid>
        
        <category>工具</category>
        
        
        <category>工具</category>
        
      </item>
    
      <item>
        <title>跨平台环境变量管理工具 - 让环境配置更简单</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#跨平台环境变量管理工具---让环境配置更简单&quot; id=&quot;markdown-toc-跨平台环境变量管理工具---让环境配置更简单&quot;&gt;跨平台环境变量管理工具 - 让环境配置更简单&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#-为什么需要这个工具&quot; id=&quot;markdown-toc--为什么需要这个工具&quot;&gt;✨ 为什么需要这个工具？&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#典型场景&quot; id=&quot;markdown-toc-典型场景&quot;&gt;典型场景&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#-核心功能一览&quot; id=&quot;markdown-toc--核心功能一览&quot;&gt;🎯 核心功能一览&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#-快速开始&quot; id=&quot;markdown-toc--快速开始&quot;&gt;🚀 快速开始&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#下载使用&quot; id=&quot;markdown-toc-下载使用&quot;&gt;下载使用&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#初始化配置&quot; id=&quot;markdown-toc-初始化配置&quot;&gt;初始化配置&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#-常用命令&quot; id=&quot;markdown-toc--常用命令&quot;&gt;📖 常用命令&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#查看和管理配置&quot; id=&quot;markdown-toc-查看和管理配置&quot;&gt;查看和管理配置&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#加载配置到当前会话&quot; id=&quot;markdown-toc-加载配置到当前会话&quot;&gt;加载配置到当前会话&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#永久设置环境变量&quot; id=&quot;markdown-toc-永久设置环境变量&quot;&gt;永久设置环境变量&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#配置加密&quot; id=&quot;markdown-toc-配置加密&quot;&gt;配置加密&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#env-文件支持&quot; id=&quot;markdown-toc-env-文件支持&quot;&gt;.env 文件支持&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#-安全最佳实践&quot; id=&quot;markdown-toc--安全最佳实践&quot;&gt;🔐 安全最佳实践&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#1-不要提交敏感配置&quot; id=&quot;markdown-toc-1-不要提交敏感配置&quot;&gt;1. 不要提交敏感配置&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#2-使用加密存储&quot; id=&quot;markdown-toc-2-使用加密存储&quot;&gt;2. 使用加密存储&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#3-本地配置覆盖&quot; id=&quot;markdown-toc-3-本地配置覆盖&quot;&gt;3. 本地配置覆盖&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#-实战技巧&quot; id=&quot;markdown-toc--实战技巧&quot;&gt;💡 实战技巧&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#技巧一创建快捷命令&quot; id=&quot;markdown-toc-技巧一创建快捷命令&quot;&gt;技巧一：创建快捷命令&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#技巧二多环境管理&quot; id=&quot;markdown-toc-技巧二多环境管理&quot;&gt;技巧二：多环境管理&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#技巧三团队协作流程&quot; id=&quot;markdown-toc-技巧三团队协作流程&quot;&gt;技巧三：团队协作流程&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#技巧四docker-集成&quot; id=&quot;markdown-toc-技巧四docker-集成&quot;&gt;技巧四：Docker 集成&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#-打包和分发&quot; id=&quot;markdown-toc--打包和分发&quot;&gt;📦 打包和分发&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#️-故障排除&quot; id=&quot;markdown-toc-️-故障排除&quot;&gt;🛠️ 故障排除&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#问题找不到配置文件&quot; id=&quot;markdown-toc-问题找不到配置文件&quot;&gt;问题：找不到配置文件&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#问题权限不足&quot; id=&quot;markdown-toc-问题权限不足&quot;&gt;问题：权限不足&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#问题macos-提示应用已损坏&quot; id=&quot;markdown-toc-问题macos-提示应用已损坏&quot;&gt;问题：macOS 提示应用已损坏&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#-总结&quot; id=&quot;markdown-toc--总结&quot;&gt;📚 总结&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;跨平台环境变量管理工具---让环境配置更简单&quot;&gt;跨平台环境变量管理工具 - 让环境配置更简单&lt;/h1&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/DJuR/env-manager&quot;&gt;&lt;img src=&quot;https://raw.githubusercontent.com/DJuR/env-manager/refs/heads/main/icon.png&quot; alt=&quot;环境变量管理器&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;在开发工作中，我们经常需要在不同的环境之间切换配置 - 比如开发环境、测试环境、生产环境，或者切换不同的 API 服务商。每次都要手动修改环境变量？太麻烦了！&lt;/p&gt;

&lt;p&gt;今天介绍一款我开发的环境变量管理工具，它可以帮助你轻松管理多个环境配置，支持一键切换，而且完全跨平台。&lt;/p&gt;

&lt;h2 id=&quot;-为什么需要这个工具&quot;&gt;✨ 为什么需要这个工具？&lt;/h2&gt;

&lt;h3 id=&quot;典型场景&quot;&gt;典型场景&lt;/h3&gt;

&lt;p&gt;想象一下这些场景：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;多 API 服务商切换&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;开发时用 OpenAI GPT-4&lt;/li&gt;
      &lt;li&gt;测试时用阿里云 Qwen&lt;/li&gt;
      &lt;li&gt;生产环境用 Anthropic Claude&lt;/li&gt;
      &lt;li&gt;每次都要改代码、改配置？&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;多环境配置&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;本地开发环境&lt;/li&gt;
      &lt;li&gt;测试环境&lt;/li&gt;
      &lt;li&gt;生产环境&lt;/li&gt;
      &lt;li&gt;如何快速切换？&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;团队协作&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;每个人有自己的 API 密钥&lt;/li&gt;
      &lt;li&gt;如何安全共享配置模板？&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;不同 Shell/平台&lt;/strong&gt;
    &lt;ul&gt;
      &lt;li&gt;Windows 的 CMD/PowerShell&lt;/li&gt;
      &lt;li&gt;Linux 的 Bash/Zsh&lt;/li&gt;
      &lt;li&gt;macOS 的 Zsh&lt;/li&gt;
      &lt;li&gt;每个平台写不同脚本？&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;这款工具就是为了解决这些问题而生的！&lt;/p&gt;

&lt;h2 id=&quot;-核心功能一览&quot;&gt;🎯 核心功能一览&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;功能&lt;/th&gt;
      &lt;th&gt;说明&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;🖥️ 全平台支持&lt;/td&gt;
      &lt;td&gt;Windows、Linux、macOS 一把梭&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;🔧 多配置管理&lt;/td&gt;
      &lt;td&gt;定义任意数量的环境配置&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;⚡ 一键切换&lt;/td&gt;
      &lt;td&gt;一个命令完成切换&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;🔒 配置加密&lt;/td&gt;
      &lt;td&gt;AES-256 保护敏感信息&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;📝 .env 支持&lt;/td&gt;
      &lt;td&gt;兼容主流 .env 格式&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;💾 永久设置&lt;/td&gt;
      &lt;td&gt;写入系统环境变量&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;📦 可执行打包&lt;/td&gt;
      &lt;td&gt;无需安装 Python&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;-快速开始&quot;&gt;🚀 快速开始&lt;/h2&gt;

&lt;h3 id=&quot;下载使用&quot;&gt;下载使用&lt;/h3&gt;

&lt;p&gt;项目支持两种使用方式：&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;方式一：使用可执行文件（推荐）&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;无需安装 Python，直接运行：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Linux/macOS&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x env-manager
./env-manager &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Windows&lt;/span&gt;
env-manager.exe &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;方式二：使用 Python 脚本&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 需要安装 Python 3.8+&lt;/span&gt;
python env-manager.py &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;初始化配置&quot;&gt;初始化配置&lt;/h3&gt;

&lt;p&gt;首次使用需要创建配置文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 方式一：复制模板&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;cp &lt;/span&gt;config.json.example config.json

&lt;span class=&quot;c&quot;&gt;# 方式二：自动初始化&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--init&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;编辑 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.json&lt;/code&gt;，填入你的实际配置：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;openai&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;OPENAI_API_KEY&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sk-your-key-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;OPENAI_BASE_URL&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://api.openai.com/v1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;MODEL&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;gpt-4&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;anthropic&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;ANTHROPIC_API_KEY&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sk-ant-your-key-here&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;ANTHROPIC_BASE_URL&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://api.anthropic.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;MODEL&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;claude-3-opus&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;-常用命令&quot;&gt;📖 常用命令&lt;/h2&gt;

&lt;h3 id=&quot;查看和管理配置&quot;&gt;查看和管理配置&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 列出所有配置&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--list&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 查看某个配置详情&lt;/span&gt;
env-manager openai &lt;span class=&quot;nt&quot;&gt;--print&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 验证配置是否完整&lt;/span&gt;
env-manager openai &lt;span class=&quot;nt&quot;&gt;--validate&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 查看应用和配置文件信息&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--info&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;加载配置到当前会话&quot;&gt;加载配置到当前会话&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Linux/macOS - 导出环境变量&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; &amp;lt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;env-manager openai &lt;span class=&quot;nt&quot;&gt;--export&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Windows CMD&lt;/span&gt;
env-manager.bat openai

&lt;span class=&quot;c&quot;&gt;# Windows PowerShell&lt;/span&gt;
.&lt;span class=&quot;se&quot;&gt;\e&lt;/span&gt;nv-manager.ps1 openai
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;永久设置环境变量&quot;&gt;永久设置环境变量&lt;/h3&gt;

&lt;p&gt;设置后重启终端依然生效：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 用户级别&lt;/span&gt;
env-manager openai &lt;span class=&quot;nt&quot;&gt;--permanent&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 系统级别（需要管理员/sudo）&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;env-manager openai &lt;span class=&quot;nt&quot;&gt;--permanent&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--scope&lt;/span&gt; system
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;配置加密&quot;&gt;配置加密&lt;/h3&gt;

&lt;p&gt;保护你的敏感信息：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 加密配置文件&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--encrypt&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 解密配置文件&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--decrypt&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 编辑加密配置&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--edit-encrypted&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;env-文件支持&quot;&gt;.env 文件支持&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 导出为 .env 文件&lt;/span&gt;
env-manager openai &lt;span class=&quot;nt&quot;&gt;--to-dotenv&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 从 .env 文件导入&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--from-dotenv&lt;/span&gt; .env new-config
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;-安全最佳实践&quot;&gt;🔐 安全最佳实践&lt;/h2&gt;

&lt;h3 id=&quot;1-不要提交敏感配置&quot;&gt;1. 不要提交敏感配置&lt;/h3&gt;

&lt;p&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.gitignore&lt;/code&gt; 忽略配置文件：&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-gitignore&quot;&gt;# 配置文件
config.json
local_config.json
config.enc

# 敏感信息
*.key
*.secret
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&quot;2-使用加密存储&quot;&gt;2. 使用加密存储&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 加密配置后再提交&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--encrypt&lt;/span&gt;
git add config.enc
git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Update encrypted config&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3-本地配置覆盖&quot;&gt;3. 本地配置覆盖&lt;/h3&gt;

&lt;p&gt;创建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;local_config.json&lt;/code&gt; 存储本地专用配置，不会被提交：&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;my-local-dev&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;API_KEY&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;local-dev-only-key&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;DEBUG&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;HOST&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;localhost:8080&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;-实战技巧&quot;&gt;💡 实战技巧&lt;/h2&gt;

&lt;h3 id=&quot;技巧一创建快捷命令&quot;&gt;技巧一：创建快捷命令&lt;/h3&gt;

&lt;p&gt;在 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.bashrc&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.zshrc&lt;/code&gt; 中添加：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Linux/macOS&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;alias &lt;/span&gt;env-use&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;source &amp;lt;(env-manager $1 --export)&apos;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 使用方式&lt;/span&gt;
env-use openai
env-use anthropic
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;技巧二多环境管理&quot;&gt;技巧二：多环境管理&lt;/h3&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;dev&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;API_BASE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://dev.api.example.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;DEBUG&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;staging&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;API_BASE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://staging.api.example.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;DEBUG&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;false&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;prod&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;API_BASE&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://api.example.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;DEBUG&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;false&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;技巧三团队协作流程&quot;&gt;技巧三：团队协作流程&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;提交配置模板 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.json.example&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;团队成员复制并修改为 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.json&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.gitignore&lt;/code&gt; 忽略实际配置文件&lt;/li&gt;
  &lt;li&gt;敏感配置使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--encrypt&lt;/code&gt; 加密&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;技巧四docker-集成&quot;&gt;技巧四：Docker 集成&lt;/h3&gt;

&lt;div class=&quot;language-dockerfile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; python:3.9-slim&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;COPY&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; env-manager /usr/local/bin/&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;COPY&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; config.enc /app/&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 解密配置并运行&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;CMD&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; sh -c &quot;echo $PASSWORD | env-manager --decrypt &amp;amp;&amp;amp; \&lt;/span&gt;
           env-manager prod --set &amp;amp;&amp;amp; \
           python app.py&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;-打包和分发&quot;&gt;📦 打包和分发&lt;/h2&gt;

&lt;p&gt;想分发给团队使用？打包成可执行文件：&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 1. 安装打包依赖&lt;/span&gt;
pip &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt; requirements.txt

&lt;span class=&quot;c&quot;&gt;# 2. 执行打包&lt;/span&gt;
python build.py

&lt;span class=&quot;c&quot;&gt;# 3. 分发 dist/ 目录&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;打包后用户无需安装 Python，直接运行即可！&lt;/p&gt;

&lt;h2 id=&quot;️-故障排除&quot;&gt;🛠️ 故障排除&lt;/h2&gt;

&lt;h3 id=&quot;问题找不到配置文件&quot;&gt;问题：找不到配置文件&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 查看配置文件位置&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--info&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# 或重新初始化&lt;/span&gt;
env-manager &lt;span class=&quot;nt&quot;&gt;--init&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;问题权限不足&quot;&gt;问题：权限不足&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Linux/macOS&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; +x env-manager

&lt;span class=&quot;c&quot;&gt;# Windows 永久设置需要管理员权限&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;问题macos-提示应用已损坏&quot;&gt;问题：macOS 提示应用已损坏&lt;/h3&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# 移除隔离属性&lt;/span&gt;
xattr &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; com.apple.quarantine env-manager
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;-总结&quot;&gt;📚 总结&lt;/h2&gt;

&lt;p&gt;这个环境变量管理工具解决了开发中常见的配置管理痛点：&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;简单&lt;/strong&gt; - 一个命令完成切换
✅ &lt;strong&gt;安全&lt;/strong&gt; - 支持加密存储敏感信息
✅ &lt;strong&gt;跨平台&lt;/strong&gt; - Windows/Linux/macOS 统一使用
✅ &lt;strong&gt;灵活&lt;/strong&gt; - 支持多种配置格式
✅ &lt;strong&gt;便携&lt;/strong&gt; - 可打包为独立可执行文件&lt;/p&gt;

&lt;p&gt;希望这个工具能提高你的开发效率！如有问题或建议，欢迎提 Issue。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;strong&gt;下载地址&lt;/strong&gt;：
&lt;a href=&quot;https://github.com/DJuR/env-manager&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;
GitHub 仓库链接
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;版本&lt;/strong&gt;：3.0.0
&lt;strong&gt;许可证&lt;/strong&gt;：MIT&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;em&gt;如果你觉得这个工具有用，欢迎 Star ⭐&lt;/em&gt;&lt;/p&gt;
</description>
        <pubDate>Thu, 05 Feb 2026 00:00:00 +0000</pubDate>
        <link>https://DJuR.github.io/%E5%B7%A5%E5%85%B7/env-manager.html</link>
        <guid isPermaLink="true">https://DJuR.github.io/%E5%B7%A5%E5%85%B7/env-manager.html</guid>
        
        <category>工具</category>
        
        
        <category>工具</category>
        
      </item>
    
      <item>
        <title>Markdown 语法</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#markdown-语法&quot; id=&quot;markdown-toc-markdown-语法&quot;&gt;Markdown 语法&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#常用语法&quot; id=&quot;markdown-toc-常用语法&quot;&gt;常用语法&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#example&quot; id=&quot;markdown-toc-example&quot;&gt;example:&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#符号&quot; id=&quot;markdown-toc-符号&quot;&gt;符号&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#扩展阅读&quot; id=&quot;markdown-toc-扩展阅读&quot;&gt;扩展阅读&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;markdown-语法&quot;&gt;Markdown 语法&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt;是一个用于web编写器将文本转换成标记语言的工具(text-to-HTML)。Markdown允许使用易于读、易于写的纯文本格式编写，然后转换成标准结构的XHTML（或HTML）.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt;做的两件事:
(1) 纯文本格式语法。
(2) 用Perl编写的工具，将纯文本转换成HTML。&lt;/p&gt;

&lt;h2 id=&quot;常用语法&quot;&gt;常用语法&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;haroopad 编辑器中快捷键&lt;/strong&gt;&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;名称&lt;/th&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;Markdown&lt;/th&gt;
      &lt;th style=&quot;text-align: right&quot;&gt;效果&lt;/th&gt;
      &lt;th style=&quot;text-align: right&quot;&gt;快捷键&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;标题&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;H*&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;加粗&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;**text**&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;strong&gt;text&lt;/strong&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+B&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;斜体&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*text*&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;em&gt;text&lt;/em&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+I&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;删除线&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~~text~~&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;del&gt;text&lt;/del&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+U&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;链接&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[title](http://)&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;a href=&quot;http://&quot;&gt;title&lt;/a&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+L&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;图片&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;![alt](http://)&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;img src=&quot;http://&quot; alt=&quot;alt&quot; /&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;代码&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;` &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;code&lt;/code&gt; `&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;code&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+K&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;列表&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;* quoteitem&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;+ quoteitem&lt;/code&gt;,&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;- quoteitem&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;引用&lt;/td&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;` &amp;gt; quote `&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt; &lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;example&quot;&gt;example:&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;标题&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;标题一
=====

标题二
------

# 标题* #[1-6]

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;列表&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
+ 列表一
- 列表二
* 列表三
1. 数字列表

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;引用&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
&amp;gt; ## This is a header.
&amp;gt; 
&amp;gt; 1.   This is the first list item.
&amp;gt; 2.   This is the second list item.
&amp;gt; 
&amp;gt; Here&apos;s some example code:
&amp;gt; 
&amp;gt;     return shell_exec(&quot;echo $input | $markdown_script&quot;);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;符号&quot;&gt;符号&lt;/h2&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th style=&quot;text-align: center&quot;&gt;Markdown&lt;/th&gt;
      &lt;th style=&quot;text-align: right&quot;&gt;效果&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;amp;copy;&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;©&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AT&amp;amp;amp;&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;AT&amp;amp;T&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td style=&quot;text-align: center&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;4&amp;amp;lt;5&lt;/code&gt;&lt;/td&gt;
      &lt;td style=&quot;text-align: right&quot;&gt;4&amp;lt;5&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;扩展阅读&quot;&gt;扩展阅读&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://daringfireball.net/projects/markdown/syntax&quot;&gt;markdown 语法&lt;/a&gt;
&lt;a href=&quot;http://wowubuntu.com/markdown/&quot;&gt;markdown中文&lt;/a&gt;&lt;/p&gt;

</description>
        <pubDate>Sat, 06 Jan 2018 00:00:00 +0000</pubDate>
        <link>https://DJuR.github.io/markdown/Markdown-%E8%AF%AD%E6%B3%95.html</link>
        <guid isPermaLink="true">https://DJuR.github.io/markdown/Markdown-%E8%AF%AD%E6%B3%95.html</guid>
        
        <category>markdown</category>
        
        
        <category>markdown</category>
        
      </item>
    
  </channel>
</rss>
