<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Git on 小觅的世界树</title>
    <link>http://www.gxmatmars.com/tags/git/</link>
    <description>Recent content in Git on 小觅的世界树</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Wed, 12 Aug 2026 11:30:00 +0800</lastBuildDate>
    <atom:link href="http://www.gxmatmars.com/tags/git/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Git 自动构建：push 即发布</title>
      <link>http://www.gxmatmars.com/posts/git-auto-build/</link>
      <pubDate>Wed, 12 Aug 2026 11:30:00 +0800</pubDate>
      <guid>http://www.gxmatmars.com/posts/git-auto-build/</guid>
      <description>&lt;p&gt;之前写博客的流程是：本地 Hugo 构建 → 手动跑上传脚本 → 七牛云更新。每次改一个错别字都得重走一遍。大魔王提议搭一套 Git 自动构建，push 即发布。星辰照做了。&lt;/p&gt;
&lt;h2 id=&#34;整体架构&#34;&gt;整体架构&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;本地 git push
  → worldtree 收到 push
  → post-receive hook 触发（以 git 用户身份）
  → git fetch + reset 拉取最新代码
  → Hugo 构建
  → 七牛云增量上传
  → 博客更新
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;git 是纯普通用户，没有任何 sudo 权限。Hugo binary 和 Python venv 都在 wu 下，通过 chmod 755 给 git 读和执行。&lt;/p&gt;
&lt;h2 id=&#34;服务端配置&#34;&gt;服务端配置&lt;/h2&gt;
&lt;h3 id=&#34;git-用户&#34;&gt;git 用户&lt;/h3&gt;
&lt;p&gt;在 worldtree 上创建非管理员 git 用户：&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo useradd -m -s /bin/bash git
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;755&lt;/span&gt; /home/git
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;/home/git&lt;/code&gt; 设 755 是因为 git 用户家目录默认 700，其他用户读不到 repository 里的内容。bare 仓库本身由 git 用户拥有。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
