{"id":911,"date":"2026-05-27T19:09:46","date_gmt":"2026-05-27T11:09:46","guid":{"rendered":"https:\/\/www.loongdi.net\/blog\/?p=911"},"modified":"2026-05-27T19:09:46","modified_gmt":"2026-05-27T11:09:46","slug":"%e5%9c%a8%e6%82%a8%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e9%83%a8%e7%bd%b2%e5%92%8c%e9%85%8d%e7%bd%ae-gitea%ef%bc%9a%e4%b8%80%e4%b8%aa%e5%bc%80%e6%ba%90-git-%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%9a%84","status":"publish","type":"post","link":"https:\/\/www.loongdi.net\/blog\/911.html","title":{"rendered":"\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6e Gitea\uff1a\u4e00\u4e2a\u5f00\u6e90 Git \u670d\u52a1\u5668\u7684\u8be6\u7ec6\u6307\u5357"},"content":{"rendered":"<p><p>\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6e <strong>Gitea<\/strong>\uff0c\u4e00\u4e2a\u57fa\u4e8e Go \u8bed\u8a00\u7684\u5f00\u6e90 Git \u670d\u52a1\u5668\u3002\u6211\u4eec\u5c06\u901a\u8fc7\u4e00\u7cfb\u5217\u7684\u6b65\u9aa4\u6765\u5b89\u88c5 Gitea\uff0c\u5e76\u8bbe\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684\u7528\u6237\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h2>\u64cd\u4f5c\u524d\u7684\u51c6\u5907<\/h2>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684\u670d\u52a1\u5668\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u64cd\u4f5c\u7cfb\u7edf\uff1aLinux \u53d1\u884c\u7248\uff08\u5982 Ubuntu, CentOS\uff09<\/li>\n<li>Go \u8bed\u8a00\u73af\u5883\uff1aGitea \u9700\u8981 Go 1.12 \u6216\u66f4\u9ad8\u7248\u672c<\/li>\n<li>\u6570\u636e\u5e93\u652f\u6301\uff1aMySQL \u6216 PostgreSQL<\/li>\n<li>\u5b58\u50a8\u7a7a\u95f4\uff1a\u81f3\u5c11 500MB \u7684\u53ef\u7528\u7a7a\u95f4<\/li>\n<\/ul>\n<p><h2>\u5b89\u88c5 Gitea<\/h2>\n<\/p>\n<p><h3>1. \u5b89\u88c5\u4f9d\u8d56<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u5b89\u88c5\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<p><pre><code>sudo apt-get update<\/p>\r\n<p>sudo apt-get install -y git make gcc go curl<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.loongdi.net\/blog\/wp-content\/uploads\/2026\/03\/K323Sk4y.jpg\" alt=\"\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6e Gitea\uff1a\u4e00\u4e2a\u5f00\u6e90 Git \u670d\u52a1\u5668\u7684\u8be6\u7ec6\u6307\u5357\" title=\"\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6e Gitea\uff1a\u4e00\u4e2a\u5f00\u6e90 Git \u670d\u52a1\u5668\u7684\u8be6\u7ec6\u6307\u5357\"><\/p>\n<p><h3>2. \u4e0b\u8f7d Gitea<\/h3>\n<\/p>\n<p><p>\u4ece Gitea \u7684 GitHub \u4ed3\u5e93\u514b\u9686\u6e90\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><pre><code>sudo git clone https:\/\/github.com\/go-gitea\/gitea.git \/opt\/gitea<\/p>\r\n<p>cd \/opt\/gitea<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3. \u521d\u59cb\u5316\u6570\u636e\u5e93<\/h3>\n<\/p>\n<p><p>\u9009\u62e9\u60a8\u60f3\u8981\u4f7f\u7528\u7684\u6570\u636e\u5e93\u7c7b\u578b\uff0c\u5e76\u521d\u59cb\u5316 Gitea \u7684\u6570\u636e\u5e93\u3002<\/p>\n<\/p>\n<ul>\n<li>\u5bf9\u4e8e MySQL\uff1a<\/li>\n<li>\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u5df2\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a `gitea` \u7684\u6570\u636e\u5e93\u548c\u7528\u6237\u3002<\/li>\n<li>\u521d\u59cb\u5316\u6570\u636e\u5e93\uff1a<\/li>\n<li>\n<p><pre><code>.\/install.sh --db mysql -u root -p [root_password] -s [database_name]<\/p>\r\n<p><\/code><\/pre>\n<\/li>\n<li>\u5bf9\u4e8e PostgreSQL\uff1a<\/li>\n<li>\u786e\u4fdd\u60a8\u5df2\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a `gitea` \u7684\u6570\u636e\u5e93\u548c\u7528\u6237\u3002<\/li>\n<li>\u521d\u59cb\u5316\u6570\u636e\u5e93\uff1a<\/li>\n<li>\n<p><pre><code>.\/install.sh --db postgres -u postgres -p [postgres_password] -s [database_name]<\/p>\r\n<p><\/code><\/pre>\n<\/li>\n<\/ul>\n<p><h3>4. \u914d\u7f6e Gitea<\/h3>\n<\/p>\n<p><p>\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\uff0c\u8bbe\u7f6e Gitea \u7684\u8fd0\u884c\u53c2\u6570\u3002<\/p>\n<\/p>\n<p><pre><code>sudo nano \/opt\/gitea\/conf\/app.ini<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u627e\u5230\u5e76\u4fee\u6539\u4ee5\u4e0b\u914d\u7f6e\u9879\uff1a<\/p>\n<\/p>\n<ul>\n<li>app.run_user\uff1a\u8bbe\u7f6e\u4e3a `gitea`\uff08\u6216\u60a8\u7684\u7cfb\u7edf\u7528\u6237\uff09<\/li>\n<li>app.run_mode\uff1a\u8bbe\u7f6e\u4e3a `prod`\uff08\u751f\u4ea7\u6a21\u5f0f\uff09<\/li>\n<li>app.url\uff1a\u8bbe\u7f6e\u4e3a\u60a8\u7684 Gitea \u670d\u52a1\u5668\u5730\u5740<\/li>\n<li>server.http_addr\uff1a\u8bbe\u7f6e\u4e3a `:3000` \u6216\u60a8\u5e0c\u671b Gitea \u8fd0\u884c\u7684\u7aef\u53e3<\/li>\n<\/ul>\n<p><h3>5. \u542f\u52a8 Gitea<\/h3>\n<\/p>\n<p><p>\u4ee5\u670d\u52a1\u5f62\u5f0f\u542f\u52a8 Gitea\u3002<\/p>\n<\/p>\n<p><pre><code>sudo .\/gitea web<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u60a8\u5e94\u8be5\u80fd\u770b\u5230 Gitea \u7684\u6b22\u8fce\u754c\u9762\uff0c\u63d0\u793a\u60a8\u521b\u5efa\u7ba1\u7406\u5458\u8d26\u6237\u3002<\/p>\n<\/p>\n<p><h2>\u7528\u6237\u7ba1\u7406<\/h2>\n<\/p>\n<p><h3>1. \u521b\u5efa\u7ba1\u7406\u5458\u8d26\u6237<\/h3>\n<\/p>\n<p><p>\u6309\u7167\u63d0\u793a\u8f93\u5165\u76f8\u5173\u4fe1\u606f\uff0c\u521b\u5efa\u60a8\u7684\u7b2c\u4e00\u4e2a\u7ba1\u7406\u5458\u8d26\u6237\u3002<\/p>\n<\/p>\n<p><h3>2. \u8bbf\u95ee Gitea<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u6d4f\u89c8\u5668\u8bbf\u95ee <strong>http:\/\/[\u60a8\u7684\u670d\u52a1\u5668\u5730\u5740]:3000<\/strong>\uff0c\u4f7f\u7528\u60a8\u521a\u624d\u521b\u5efa\u7684\u7ba1\u7406\u5458\u8d26\u6237\u767b\u5f55\u3002<\/p>\n<\/p>\n<p><h2>\u5e38\u89c1\u95ee\u9898\u4e0e\u6ce8\u610f\u4e8b\u9879<\/h2>\n<\/p>\n<ul>\n<li>\u95ee\u9898\uff1aGitea \u65e0\u6cd5\u542f\u52a8\u3002<\/li>\n<li>\u539f\u56e0\uff1a\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u6216\u914d\u7f6e\u9519\u8bef\u3002<\/li>\n<li>\u89e3\u51b3\u65b9\u6cd5\uff1a\u68c0\u67e5\u6570\u636e\u5e93\u914d\u7f6e\uff0c\u786e\u4fdd\u6570\u636e\u5e93\u670d\u52a1\u8fd0\u884c\u6b63\u5e38\u3002<\/li>\n<\/ul>\n<ul>\n<li>\u95ee\u9898\uff1aGitea \u8fd0\u884c\u7f13\u6162\u3002<\/li>\n<li>\u539f\u56e0\uff1a\u670d\u52a1\u5668\u8d44\u6e90\u4e0d\u8db3\u6216\u914d\u7f6e\u4e0d\u5f53\u3002<\/li>\n<li>\u89e3\u51b3\u65b9\u6cd5\uff1a\u589e\u52a0\u670d\u52a1\u5668\u8d44\u6e90\u6216\u4f18\u5316 Gitea \u914d\u7f6e\u3002<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5df2\u7ecf\u6210\u529f\u5728\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u4e86 Gitea\u3002\u73b0\u5728\u60a8\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528\u5b83\u6765\u7ba1\u7406\u60a8\u7684 Git \u4ed3\u5e93\u4e86\u3002<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u90e8\u7f72\u548c\u914d\u7f6e Gitea\uff0c\u4e00\u4e2a\u57fa\u4e8e Go \u8bed\u8a00\u7684\u5f00\u6e90 Git \u670d\u52a1\u5668\u3002\u6211\u4eec\u5c06\u901a\u8fc7\u4e00\u7cfb\u5217\u7684\u6b65\u9aa4\u6765\u5b89\u88c5 Gitea\uff0c\u5e76\u8bbe\u7f6e\u4e00\u4e2a\u57fa\u672c\u7684\u7528\u6237\u73af\u5883\u3002 \u64cd\u4f5c\u524d\u7684\u51c6\u5907 \u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u60a8\u7684\u670d\u52a1\u5668\u6ee1\u8db3\u4ee5\u4e0b\u8981\u6c42\uff1a \u64cd\u4f5c\u7cfb\u7edf\uff1aL&#8230;<\/p>\n","protected":false},"author":1,"featured_media":163,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-yun"],"_links":{"self":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/comments?post=911"}],"version-history":[{"count":1,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/911\/revisions"}],"predecessor-version":[{"id":912,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/911\/revisions\/912"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media\/163"}],"wp:attachment":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media?parent=911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/categories?post=911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/tags?post=911"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/topic?post=911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}