{"id":80047,"date":"2026-03-04T08:17:10","date_gmt":"2026-03-04T00:17:10","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/80047.html"},"modified":"2026-03-04T08:17:10","modified_gmt":"2026-03-04T00:17:10","slug":"%e5%9c%a8centos%e4%b8%8a%e9%83%a8%e7%bd%b2gitea%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/80047.html","title":{"rendered":"\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668"},"content":{"rendered":"<p>\u4e3a\u4e86\u65b9\u4fbf\u6e90\u4ee3\u7801\u7ba1\u7406&#xff0c;\u6211\u5411\u516c\u53f8\u7533\u8bf7\u4e86\u4e2acentos7\u865a\u62df\u673a&#xff0c;\u5728\u4e0a\u9762\u90e8\u7f72gitea&#xff0c;\u7136\u540e\u901a\u8fc7vpn&#xff0c;\u5e73\u65f6\u51fa\u5dee\u5728\u5916&#xff0c;\u4e5f\u80fd\u8bbf\u95ee&#xff0c;\u4fdd\u8bc1\u6e90\u4ee3\u7801\u7684\u7ba1\u7406\u3002<\/p>\n<p>\u5b89\u88c5\u5185\u5bb9&#xff1a;<br \/>\n1&#xff09;\u5b89\u88c5git<br \/>\nGitea\u4f9d\u8d56\u4e8egit\u8fd0\u884c&#xff0c;\u6240\u4ee5\u5b89\u88c5Gitea\u7684\u8bdd&#xff0c;\u670d\u52a1\u5668\u8981\u5148\u6709git\u3002Centos 7\u81ea\u5e26\u4e86\u4e00\u4e2agit&#xff0c;\u4f46\u7248\u672c\u592a\u8001&#xff0c;\u9700\u8981\u5148\u5347\u7ea7git&#xff0c;\u7136\u540e\u518d\u5b89\u88c5Gitea\u3002\u5347\u7ea7git\u7684\u529e\u6cd5&#xff0c;\u662f\u4e0b\u8f7dgit\u6e90\u7801\u7f16\u8bd1\u3001\u5b89\u88c5\u3002<br \/>\n2&#xff09;\u5b89\u88c5nginx<br \/>\n\u7531\u4e8eGitea\u7684\u9ed8\u8ba4\u7aef\u53e3\u662f3000&#xff0c;\u5e76\u4e0d\u9002\u5408\u76f4\u63a5\u5bf9\u5916\u66b4\u9732&#xff0c;\u4e00\u822c\u5bf9\u5916\u662f80\/443&#xff0c;\u5982\u679c\u7ed1\u5b9a\u57df\u540d\u8bbf\u95ee\u3001HTTPS \u52a0\u5bc6\u548c\u66f4\u5f3a\u5927\u7684\u9759\u6001\u8d44\u6e90\u5904\u7406\u80fd\u529b&#xff0c;\u8fd9\u4e9bGitea\u66f4\u52a0\u65e0\u6cd5\u5e94\u5bf9&#xff0c;\u56e0\u6b64\u8fd8\u8981\u5b89\u88c5nginx\u3002<br \/>\n3&#xff09;\u5b89\u88c5Gitea<\/p>\n<p>\u4ee5\u4e0b\u662f\u8be6\u7ec6\u4ecb\u7ecd\u3002\u8fd9\u662f\u6839\u636e\u64cd\u4f5c\u5386\u53f2&#xff08;history)\u6574\u7406\u7684&#xff0c;\u53ef\u80fd\u6709\u758f\u6f0f&#xff0c;\u5148\u8bb0\u5f55\u3002\u6709\u6587\u6863\u603b\u6bd4\u6ca1\u6709\u5f3a\u3002<\/p>\n<h2>1. \u7cfb\u7edf\u73af\u5883\u51c6\u5907<\/h2>\n<h3>1.1 \u66f4\u6362 Yum \u6e90 (\u963f\u91cc\u4e91)<\/h3>\n<p>\u4e3a\u4e86\u52a0\u5feb\u4e0b\u8f7d\u901f\u5ea6&#xff0c;\u66ff\u6362\u9ed8\u8ba4\u7684 CentOS \u6e90\u4e3a\u963f\u91cc\u4e91\u955c\u50cf\u6e90\u3002<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">rm<\/span> \/etc\/yum.repos.d\/CentOS-Base.repo<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-o<\/span> \/etc\/yum.repos.d\/CentOS-Base.repo https:\/\/mirrors.aliyun.com\/repo\/Centos-7.repo<br \/>\n<span class=\"token function\">sudo<\/span> yum clean all<br \/>\n<span class=\"token function\">sudo<\/span> yum makecache<br \/>\n<span class=\"token function\">sudo<\/span> yum update <span class=\"token parameter variable\">-y<\/span><\/p>\n<h3>1.2 \u5b89\u88c5\u57fa\u7840\u4f9d\u8d56<\/h3>\n<p>\u5b89\u88c5 EPEL \u6e90&#xff0c; CentOS \u7cfb\u7edf\u4e2d\u6781\u5176\u91cd\u8981\u7684\u4e00\u4e2a\u8f6f\u4ef6\u6e90\u6269\u5c55\u5305&#xff0c;\u5229\u4e8e\u5b89\u88c5nginx\u3002<\/p>\n<p><span class=\"token function\">sudo<\/span> yum <span class=\"token function\">install<\/span> <span class=\"token parameter variable\">-y<\/span> epel-release<\/p>\n<h2>2. \u5b89\u88c5 Nginx<\/h2>\n<p><span class=\"token function\">sudo<\/span> yum <span class=\"token function\">install<\/span> <span class=\"token parameter variable\">-y<\/span> nginx<br \/>\n<span class=\"token function\">sudo<\/span> systemctl start nginx<br \/>\n<span class=\"token function\">sudo<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> nginx<\/p>\n<h2>3. \u5347\u7ea7git<\/h2>\n<p>centos7\u81ea\u5e26\u7684git\u592a\u65e7&#xff0c;\u4e5f\u8bb8\u7531\u4e8ecentos7\u65e9\u5df2\u505c\u6b62\u7ef4\u62a4\u7684\u7f18\u6545&#xff0c;\u5373\u4f7f\u4e0b\u8f7d\u5b89\u88c5git&#xff0c;\u5f97\u5230\u7684\u4e5f\u662f\u5f88\u65e7\u7684\u7248\u672c&#xff0c;\u6839\u672c\u6ee1\u8db3\u4e0d\u4e86gitea\u7684\u8fd0\u884c\u8981\u6c42\u3002\u56e0\u6b64\u9700\u8981\u4e0b\u8f7dgit\u6e90\u7801\u8fdb\u884c\u7f16\u8bd1\u3001\u5b89\u88c5\u3002\u5426\u5219\u5b89\u88c5\u4e86gitea\u4e5f\u65e0\u6cd5\u8fd0\u884c&#xff1a;<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260304001708-69a77a04e2ddc.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>3.1\u4e0b\u8f7d\u6e90\u7801<\/h3>\n<p>\u7248\u672c\u53f7\u53ef\u6839\u636e\u9700\u8981\u8c03\u6574<\/p>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-LO<\/span> https:\/\/mirrors.edge.kernel.org\/pub\/software\/scm\/git\/git-2.39.5.tar.xz<br \/>\n<span class=\"token function\">tar<\/span> <span class=\"token parameter variable\">-xf<\/span> git-2.39.5.tar.xz<br \/>\n<span class=\"token builtin class-name\">cd<\/span> git-2.39.5<\/p>\n<h3>3.2\u7f16\u8bd1\u5b89\u88c5<\/h3>\n<p><span class=\"token function\">make<\/span> configure<br \/>\n.\/configure <span class=\"token parameter variable\">&#8211;prefix<\/span><span class=\"token operator\">&#061;<\/span>\/usr\/local<br \/>\n<span class=\"token function\">make<\/span> all doc info<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">make<\/span> <span class=\"token function\">install<\/span> install-doc install-html install-info<\/p>\n<h3>3.3\u66ff\u6362\u7cfb\u7edf Git<\/h3>\n<p>\u5907\u4efd\u65e7\u7248\u672c<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">mv<\/span> \/usr\/bin\/git \/usr\/bin\/git.bak<\/p>\n<p>\u521b\u5efa\u8f6f\u94fe\u63a5\u6307\u5411\u65b0\u7248\u672c<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">ln<\/span> <span class=\"token parameter variable\">-s<\/span> \/usr\/local\/bin\/git \/usr\/bin\/git<\/p>\n<p>\u9a8c\u8bc1\u7248\u672c<\/p>\n<p><span class=\"token function\">git<\/span> <span class=\"token parameter variable\">&#8211;version<\/span><\/p>\n<p>\u8f93\u51fa\u5e94\u4e3a&#xff1a;git version 2.39.5<\/p>\n<h2>4. \u90e8\u7f72 Gitea<\/h2>\n<h3>4.1\u5b89\u88c5\u524d\u51c6\u5907<\/h3>\n<h4>1&#xff09;\u521b\u5efa\u4e13\u7528 git \u7528\u6237<\/h4>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">useradd<\/span> <span class=\"token parameter variable\">&#8211;system<\/span> <span class=\"token punctuation\">\\\\<\/span> <span class=\"token parameter variable\">&#8211;shell<\/span> \/bin\/bash <span class=\"token punctuation\">\\\\<\/span> <span class=\"token parameter variable\">&#8211;comment<\/span> <span class=\"token string\">&#039;Git User&#039;<\/span> <span class=\"token punctuation\">\\\\<\/span> &#8211;create-home <span class=\"token punctuation\">\\\\<\/span> &#8211;user-group <span class=\"token function\">git<\/span><\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">passwd<\/span> <span class=\"token function\">git<\/span><\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-s<\/span> \/usr\/bin\/git-shell <span class=\"token function\">git<\/span><\/p>\n<h4>2&#xff09;\u521b\u5efa Gitea \u6570\u636e\u76ee\u5f55<\/h4>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">mkdir<\/span> <span class=\"token parameter variable\">-p<\/span> \/var\/lib\/gitea\/<span class=\"token punctuation\">{<\/span>custom,data,log<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> git:git \/var\/lib\/gitea<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token parameter variable\">-R<\/span> <span class=\"token number\">750<\/span> \/var\/lib\/gitea<\/p>\n<h4>3&#xff09;\u521b\u5efa\u914d\u7f6e\u76ee\u5f55<\/h4>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">mkdir<\/span> \/etc\/gitea<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> root:git \/etc\/gitea<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token number\">770<\/span> \/etc\/gitea<\/p>\n<h4>4&#xff09; \u9632\u706b\u5899\u914d\u7f6e<\/h4>\n<p>\u5f00\u653e\u7aef\u53e3<\/p>\n<p><span class=\"token function\">sudo<\/span> firewall-cmd <span class=\"token parameter variable\">&#8211;permanent<\/span> &#8211;add-service<span class=\"token operator\">&#061;<\/span>http<br \/>\n<span class=\"token function\">sudo<\/span> firewall-cmd <span class=\"token parameter variable\">&#8211;permanent<\/span> &#8211;add-port<span class=\"token operator\">&#061;<\/span><span class=\"token number\">3000<\/span>\/tcp <span class=\"token comment\"># \u5982\u679c\u76f4\u63a5\u8bbf\u95eeGitea<\/span><br \/>\n<span class=\"token function\">sudo<\/span> firewall-cmd <span class=\"token parameter variable\">&#8211;reload<\/span><\/p>\n<h3>4.2 \u4e0b\u8f7d<\/h3>\n<p><span class=\"token builtin class-name\">cd<\/span> \/tmp<\/p>\n<p>\u4e0b\u8f7d Gitea (\u793a\u4f8b\u7248\u672c 1.21.6)<\/p>\n<p><span class=\"token function\">wget<\/span> https:\/\/dl.gitea.io\/gitea\/1.21.6\/gitea-1.21.6-linux-amd64<\/p>\n<p>\u79fb\u52a8\u81f3\u7cfb\u7edf\u8def\u5f84\u5e76\u8d4b\u4e88\u6267\u884c\u6743\u9650<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">mv<\/span> gitea-1.21.6-linux-amd64 \/usr\/local\/bin\/gitea<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> &#043;x \/usr\/local\/bin\/gitea<\/p>\n<p>\u9a8c\u8bc1\u5b89\u88c5<\/p>\n<p>\/usr\/local\/bin\/gitea <span class=\"token parameter variable\">&#8211;version<\/span><\/p>\n<h3>4.3 \u542f\u52a8Gitea<\/h3>\n<p>\u521b\u5efa\u670d\u52a1\u6587\u4ef6 \/etc\/systemd\/system\/gitea.service (\u9700\u4f7f\u7528 sudo vi \u7f16\u8f91)\u3002<\/p>\n<p>\u914d\u7f6e\u5b8c\u6210\u540e\u91cd\u8f7d\u5e76\u542f\u52a8\u670d\u52a1&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> systemctl daemon-reload<br \/>\n<span class=\"token function\">sudo<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> gitea<br \/>\n<span class=\"token function\">sudo<\/span> systemctl start gitea<br \/>\n<span class=\"token function\">sudo<\/span> systemctl status gitea<\/p>\n<h3>4.4 \u914d\u7f6e<\/h3>\n<p>gitea\u662f\u6709\u56fe\u5f62\u5316\u7684\u5b89\u88c5\u754c\u9762\u7684\u3002\u4f46\u6211\u62ff\u5230\u7684\u670d\u52a1\u5668&#xff0c;\u53ea\u80fd\u901a\u8fc7ssh\u8fdc\u7a0b\u8bbf\u95ee&#xff0c;\u7ba1\u7406\u5458\u4e5f\u53ea\u5f00\u653e\u4e8622\u548c80,443 \u4e09\u4e2a\u7aef\u53e3\u3002\u7531\u4e8egitea\u7684\u9ed8\u8ba4\u5bf9\u5916\u7aef\u53e3\u662f3000&#xff0c;\u5982\u679c\u53bb\u627e\u7ba1\u7406\u5458\u5f00\u901a3000\u7aef\u53e3&#xff0c;\u6bd4\u8f83\u8017\u65f6\u3002\u8fd9\u65f6\u53ef\u4ee5\u5c06\u672c\u5730\u7684\u7aef\u53e3&#xff08;\u6bd4\u59823001&#xff09;\u6620\u5c04\u5230\u670d\u52a1\u5668\u768422\u7aef\u53e3&#xff0c;\u5373\u76d1\u542c\u672c\u57303001\u7aef\u53e3&#xff0c;\u51e1\u4efb\u4f55\u53d1\u9001\u5230\u672c\u5730 3001 \u7aef\u53e3\u7684\u6570\u636e&#xff0c;\u90fd\u4f1a\u901a\u8fc7 SSH \u901a\u9053&#xff0c;\u81ea\u52a8\u8f6c\u53d1\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u5728\u672c\u5730\u6d4f\u89c8\u5668\u8bbf\u95eehttp:\/\/localhost:3001&#xff0c;\u5c31\u80fd\u591f\u8bbf\u95ee\u670d\u52a1\u5668\u4e0a\u7684gitea\u914d\u7f6e\u754c\u9762\u3002<\/p>\n<p>\u5728\u672c\u5730\u7684\u547d\u4ee4\u884c\u7a97\u53e3\u8fd0\u884c&#xff1a;<\/p>\n<p><span class=\"token function\">ssh<\/span> <span class=\"token parameter variable\">-L<\/span> <span class=\"token number\">3001<\/span>:localhost:3000 coder&#064;\u670d\u52a1\u5668IP<\/p>\n<p>\u7136\u540e\u5728\u672c\u5730\u6d4f\u89c8\u5668\u4e0a\u8f93\u5165&#xff1a;http:\/\/localhost:3001\u3002<\/p>\n<p>\u4e0a\u8ff0\u6620\u5c04\u4e0d\u662f\u6c38\u4e45\u7684&#xff0c;\u628a\u547d\u4ee4\u884c\u7a97\u53e3\u5173\u95ed\u4ee5\u540e&#xff0c;\u6620\u5c04\u5373\u6d88\u5931\u3002<\/p>\n<h3>4.5 \u521d\u59cb\u5316\u4e0e\u6743\u9650\u4fee\u590d<\/h3>\n<p>Gitea \u9996\u6b21\u8fd0\u884c\u540e\u4f1a\u751f\u6210\u914d\u7f6e\u6587\u4ef6&#xff0c;\u9700\u786e\u4fdd git \u7528\u6237\u6709\u6743\u9650\u8bbf\u95ee\u3002<\/p>\n<p>\u68c0\u67e5\u914d\u7f6e\u76ee\u5f55<\/p>\n<p><span class=\"token function\">ls<\/span> \/etc\/gitea\/<\/p>\n<p>\u4fee\u6b63\u6743\u9650 (\u5173\u952e\u6b65\u9aa4&#xff0c;\u9632\u6b62\u542f\u52a8\u5931\u8d25)<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260304001709-69a77a0500227.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> git:git \/etc\/gitea<br \/>\n<span class=\"token function\">sudo<\/span> <span class=\"token function\">chmod<\/span> <span class=\"token parameter variable\">-R<\/span> <span class=\"token number\">750<\/span> \/etc\/gitea<\/p>\n<p>\u5982\u679c app.ini \u7f3a\u5931\u6216\u9700\u8981\u91cd\u7f6e&#xff0c;\u53ef\u624b\u52a8\u751f\u6210\u9ed8\u8ba4\u914d\u7f6e<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token parameter variable\">-u<\/span> <span class=\"token function\">git<\/span> \/usr\/local\/bin\/gitea dump-config <span class=\"token operator\">&gt;<\/span> \/etc\/gitea\/app.ini<\/p>\n<p>\u91cd\u542f\u670d\u52a1\u4f7f\u914d\u7f6e\u751f\u6548<\/p>\n<p><span class=\"token function\">sudo<\/span> systemctl restart gitea<\/p>\n<h2>5. \u914d\u7f6e Nginx \u53cd\u5411\u4ee3\u7406<\/h2>\n<p>\u4e3a\u4e86\u901a\u8fc7 80 \u7aef\u53e3\u8bbf\u95ee Gitea&#xff0c;\u914d\u7f6e Nginx \u53cd\u5411\u4ee3\u7406\u3002HTTPS\u672a\u914d\u7f6e\u3002<\/p>\n<h3>5.1 \u914d\u7f6e Nginx<\/h3>\n<p>server <span class=\"token punctuation\">{<\/span><br \/>\n    listen <span class=\"token number\">80<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    server_name your_domain_or_ip<span class=\"token punctuation\">;<\/span> <span class=\"token comment\"># \u66ff\u6362\u4e3a\u5b9e\u9645\u57df\u540d\u6216IP<\/span><\/p>\n<p>    location \/ <span class=\"token punctuation\">{<\/span><br \/>\n        proxy_pass http:\/\/127.0.0.1:3000<span class=\"token punctuation\">;<\/span><br \/>\n        proxy_set_header Host <span class=\"token variable\">$host<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        proxy_set_header X-Real-IP <span class=\"token variable\">$remote_addr<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        proxy_set_header X-Forwarded-For <span class=\"token variable\">$proxy_add_x_forwarded_for<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        proxy_set_header X-Forwarded-Proto <span class=\"token variable\">$scheme<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u6ce8&#xff1a;\u82e5\u9700 HTTPS&#xff0c;\u9700\u5728\u914d\u7f6e\u4e2d\u76d1\u542c 443 \u7aef\u53e3\u5e76\u5f15\u7528\u4e0a\u8ff0\u751f\u6210\u7684\u8bc1\u4e66\u6587\u4ef6\u3002<\/p>\n<h3>5.2 \u89e3\u51b3 SELinux \u6743\u9650\u95ee\u9898<\/h3>\n<p>\u5982\u679c Nginx \u65e0\u6cd5\u8fde\u63a5\u540e\u7aef 3000 \u7aef\u53e3&#xff0c;\u9700\u5f00\u542f SELinux \u5141\u8bb8\u7f51\u7edc\u8fde\u63a5&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> setsebool <span class=\"token parameter variable\">-P<\/span> httpd_can_network_connect <span class=\"token number\">1<\/span><\/p>\n<h3>5.3 \u9a8c\u8bc1\u5e76\u91cd\u8f7d Nginx<\/h3>\n<p>\u8bed\u6cd5\u68c0\u67e5<\/p>\n<p><span class=\"token function\">sudo<\/span> nginx <span class=\"token parameter variable\">-t<\/span><\/p>\n<p>\u91cd\u8f7d\u914d\u7f6e<\/p>\n<p><span class=\"token function\">sudo<\/span> systemctl reload nginx<\/p>\n<p>\u6d4b\u8bd5\u8bbf\u95ee<\/p>\n<p><span class=\"token function\">curl<\/span> http:\/\/127.0.0.1<\/p>\n<h2>6. \u786e\u4fdd Git \u7528\u6237 Shell \u6b63\u786e<\/h2>\n<p>git \u7528\u6237\u5fc5\u987b\u6709\u5408\u6cd5\u7684 Shell \u624d\u80fd\u767b\u5f55\u6267\u884c\u547d\u4ee4\u3002<\/p>\n<p>\u67e5\u770b git \u7528\u6237 shell<\/p>\n<p><span class=\"token function\">grep<\/span> <span class=\"token string\">&#034;^git:&#034;<\/span> \/etc\/passwd<\/p>\n<p>\u5982\u679c\u4e0d\u662f \/bin\/bash \u6216 \/bin\/sh&#xff0c;\u4fee\u6539\u5b83<\/p>\n<p><span class=\"token function\">sudo<\/span> <span class=\"token function\">usermod<\/span> <span class=\"token parameter variable\">-s<\/span> \/bin\/bash <span class=\"token function\">git<\/span><\/p>\n<p>\u5982\u679cgit\u7528\u6237\u7684shell\u4e0d\u884c&#xff0c;\u5728\u5ba2\u6237\u7aef\u65e0\u6cd5\u4f7f\u7528ssh\u65b9\u5f0f\u6765\u8bfb\u53d6\u6216\u63d0\u4ea4\u8d44\u6599\u3002\u4f1a\u62a5\u7c7b\u4f3c\u5982\u4e0b\u7684\u9519\u3002<\/p>\n<p>E:<span class=\"token punctuation\">\\\\<\/span>\u82b1\u679c\u5c71<span class=\"token punctuation\">\\\\<\/span><span class=\"token number\">2026<\/span><span class=\"token punctuation\">\\\\<\/span>document<span class=\"token operator\">&gt;<\/span>ssh <span class=\"token parameter variable\">-T<\/span> git&#064;\u670d\u52a1\u5668IP<br \/>\nfatal: unrecognized <span class=\"token builtin class-name\">command<\/span> <span class=\"token string\">&#039;\/usr\/local\/bin\/gitea &#8211;config&#061;\/etc\/gitea\/app.ini serv key-4&#039;<\/span><\/p>\n<h2>7. git\u7684http\u4e0essh\u65b9\u5f0f<\/h2>\n<p>\u6211\u4eec\u5728\u8bfb\u53d6\u6216\u63d0\u4ea4\u4ee3\u7801\u7684\u65f6\u5019&#xff0c;\u53ef\u4ee5\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f&#xff0c;http\u6216ssh\u65b9\u5f0f\u3002\u6709\u4ec0\u4e48\u4e0d\u4e00\u6837\u5417&#xff1f;<\/p>\n<p>http&#xff0c;http:\/\/162.17.80.72\/hdw\/sz2026-document.git<br \/>\nssh&#xff0c;git&#064;162.17.80.72:hdw\/sz2026-document.git<\/p>\n<p>\u7b80\u800c\u8a00\u4e4b&#xff0c;<br \/>\nhttp\u9996\u6b21\u8bbf\u95ee&#xff0c;\u5ba2\u6237\u7aef\u9700\u8981\u8f93\u5165\u8d26\u53f7\u5bc6\u7801&#xff1b;\u4f20\u8f93\u8d44\u6599\u6709\u5927\u5c0f\u9650\u5236&#xff0c;\u8d85\u8fc71G\u7684\u6700\u597d\u4e0d\u8003\u8651&#xff1b;<br \/>\nSSH\u65b9\u5f0f&#xff0c;\u9700\u8981\u7528\u6237\u5148\u5728\u670d\u52a1\u5668\u767b\u8bb0\u81ea\u5df1\u7684SSH\u516c\u94a5&#xff0c;\u9996\u6b21\u8bbf\u95ee\u65e0\u987b\u8f93\u5165\u8d26\u53f7\u5bc6\u7801&#xff0c;\u7cfb\u7edf\u51ed\u516c\u94a5\u81ea\u52a8\u5339\u914d\u5230\u8d26\u6237&#xff1b;\u4f20\u8f93\u8d44\u6599\u6ca1\u6709\u5927\u5c0f\u9650\u5236\u3002\u6240\u4ee5&#xff0c;\u5e94\u8be5\u9996\u9009SSH\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4e86\u65b9\u4fbf\u6e90\u4ee3\u7801\u7ba1\u7406&#xff0c;\u6211\u5411\u516c\u53f8\u7533\u8bf7\u4e86\u4e2acentos7\u865a\u62df\u673a&#xff0c;\u5728\u4e0a\u9762\u90e8\u7f72gitea&#xff0c;\u7136\u540e\u901a\u8fc7vpn&#xff0c;\u5e73\u65f6\u51fa\u5dee\u5728\u5916&#xff0c;\u4e5f\u80fd\u8bbf\u95ee&#xff0c;\u4fdd\u8bc1\u6e90\u4ee3\u7801\u7684\u7ba1\u7406\u3002<br \/>\n\u5b89\u88c5\u5185\u5bb9&#xff1a;<br \/>\n1&#xff09;\u5b89\u88c5git<br \/>\nGitea\u4f9d\u8d56\u4e8egit\u8fd0\u884c&#xff0c;\u6240\u4ee5\u5b89\u88c5Gitea\u7684\u8bdd&#xff0c;\u670d\u52a1\u5668\u8981\u5148\u6709git\u3002Centos 7\u81ea\u5e26\u4e86\u4e00\u4e2agit&#xff0c;\u4f46\u7248\u672c\u592a\u8001&#xff0c;\u9700\u8981\u5148\u5347\u7ea7git&amp;#xff<\/p>\n","protected":false},"author":2,"featured_media":80045,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8966,8968,8967,241],"topic":[],"class_list":["post-80047","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-gitea","tag-git"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/80047.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e3a\u4e86\u65b9\u4fbf\u6e90\u4ee3\u7801\u7ba1\u7406&#xff0c;\u6211\u5411\u516c\u53f8\u7533\u8bf7\u4e86\u4e2acentos7\u865a\u62df\u673a&#xff0c;\u5728\u4e0a\u9762\u90e8\u7f72gitea&#xff0c;\u7136\u540e\u901a\u8fc7vpn&#xff0c;\u5e73\u65f6\u51fa\u5dee\u5728\u5916&#xff0c;\u4e5f\u80fd\u8bbf\u95ee&#xff0c;\u4fdd\u8bc1\u6e90\u4ee3\u7801\u7684\u7ba1\u7406\u3002 \u5b89\u88c5\u5185\u5bb9&#xff1a; 1&#xff09;\u5b89\u88c5git Gitea\u4f9d\u8d56\u4e8egit\u8fd0\u884c&#xff0c;\u6240\u4ee5\u5b89\u88c5Gitea\u7684\u8bdd&#xff0c;\u670d\u52a1\u5668\u8981\u5148\u6709git\u3002Centos 7\u81ea\u5e26\u4e86\u4e00\u4e2agit&#xff0c;\u4f46\u7248\u672c\u592a\u8001&#xff0c;\u9700\u8981\u5148\u5347\u7ea7git&amp;#xff\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/80047.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-04T00:17:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260304001708-69a77a04e2ddc.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/80047.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/80047.html\",\"name\":\"\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-03-04T00:17:10+00:00\",\"dateModified\":\"2026-03-04T00:17:10+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/80047.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/80047.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/80047.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/80047.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e3a\u4e86\u65b9\u4fbf\u6e90\u4ee3\u7801\u7ba1\u7406&#xff0c;\u6211\u5411\u516c\u53f8\u7533\u8bf7\u4e86\u4e2acentos7\u865a\u62df\u673a&#xff0c;\u5728\u4e0a\u9762\u90e8\u7f72gitea&#xff0c;\u7136\u540e\u901a\u8fc7vpn&#xff0c;\u5e73\u65f6\u51fa\u5dee\u5728\u5916&#xff0c;\u4e5f\u80fd\u8bbf\u95ee&#xff0c;\u4fdd\u8bc1\u6e90\u4ee3\u7801\u7684\u7ba1\u7406\u3002 \u5b89\u88c5\u5185\u5bb9&#xff1a; 1&#xff09;\u5b89\u88c5git Gitea\u4f9d\u8d56\u4e8egit\u8fd0\u884c&#xff0c;\u6240\u4ee5\u5b89\u88c5Gitea\u7684\u8bdd&#xff0c;\u670d\u52a1\u5668\u8981\u5148\u6709git\u3002Centos 7\u81ea\u5e26\u4e86\u4e00\u4e2agit&#xff0c;\u4f46\u7248\u672c\u592a\u8001&#xff0c;\u9700\u8981\u5148\u5347\u7ea7git&amp;#xff","og_url":"https:\/\/www.wsisp.com\/helps\/80047.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-03-04T00:17:10+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/03\/20260304001708-69a77a04e2ddc.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/80047.html","url":"https:\/\/www.wsisp.com\/helps\/80047.html","name":"\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-03-04T00:17:10+00:00","dateModified":"2026-03-04T00:17:10+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/80047.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/80047.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/80047.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5728centos\u4e0a\u90e8\u7f72gitea\u670d\u52a1\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/80047","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=80047"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/80047\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/80045"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=80047"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=80047"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=80047"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=80047"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}