{"id":104711,"date":"2026-09-13T04:09:03","date_gmt":"2026-09-12T20:09:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/104711.html"},"modified":"2026-09-13T04:09:03","modified_gmt":"2026-09-12T20:09:03","slug":"%e3%80%90git%e3%80%91gitlab-18-9-%e5%85%a8%e5%b1%80%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%92%a9%e5%ad%90%ef%bc%88server-hooks%ef%bc%89%e5%ae%98%e6%96%b9%e8%a7%84%e8%8c%83%e4%b8%8e%e8%90%bd%e5%9c%b0%e5%ae%9e","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/104711.html","title":{"rendered":"\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5"},"content":{"rendered":"<p>\u6587\u6863\u6765\u6e90&#xff1a;https:\/\/archives.docs.gitlab.com\/18.9\/administration\/server_hooks\/?tab&#061;Linux&#043;package&#043;%28Omnibus%29<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u6982\u8ff0<\/h3>\n<p>Git Server Hooks \u662f\u8fd0\u884c\u5728 GitLab \u670d\u52a1\u7aef\u7684\u81ea\u5b9a\u4e49\u903b\u8f91&#xff0c;\u53ef\u7528\u4e8e\u63d0\u4ea4\u89c4\u8303\u6821\u9a8c\u3001\u5206\u652f\u6743\u9650\u63a7\u5236\u3001\u72b6\u6001\u89e6\u53d1\u4efb\u52a1\u7b49\u3002<br \/>\n\u652f\u6301\u4e09\u79cd\u6807\u51c6 Git \u94a9\u5b50&#xff1a;<\/p>\n<ul>\n<li>pre-receive&#xff1a;\u63a5\u6536\u63a8\u9001\u524d\u6267\u884c&#xff0c;\u53ef\u62d2\u7edd\u6574\u4e2a\u63a8\u9001<\/li>\n<li>update&#xff1a;\u6bcf\u4e2a\u5206\u652f\u66f4\u65b0\u524d\u6267\u884c\u4e00\u6b21&#xff0c;\u53ef\u62d2\u7edd\u5355\u5206\u652f<\/li>\n<li>post-receive&#xff1a;\u5168\u90e8\u66f4\u65b0\u5b8c\u6210\u540e\u6267\u884c&#xff0c;\u4e0d\u53ef\u62d2\u7edd\u63a8\u9001<\/li>\n<\/ul>\n<p>\u9002\u7528\u7248\u672c&#xff1a;GitLab Free\/Premium\/Ultimate&#xff08;\u81ea\u6258\u7ba1&#xff09;<br \/>\n\u90e8\u7f72\u65b9\u5f0f&#xff1a;Linux package (Omnibus)<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u524d\u7f6e\u6761\u4ef6<\/h3>\n<li>GitLab \u670d\u52a1\u5668 root \u6743\u9650<\/li>\n<li>Gitaly \u914d\u7f6e\u6587\u4ef6\u8def\u5f84&#xff08;\u9ed8\u8ba4&#xff09;&#xff1a;<br \/>\n\/var\/opt\/gitlab\/gitaly\/config.toml<\/li>\n<li>\u94a9\u5b50\u811a\u672c\u5fc5\u987b\u53ef\u6267\u884c&#xff0c;\u5c5e\u4e3b\u4e3a git:git<\/li>\n<li>\u811a\u672c\u4e0d\u5339\u914d\u5907\u4efd\u6587\u4ef6\u540e\u7f00&#xff08;\u5982 *~&#xff09;<\/li>\n<hr \/>\n<h3>\u4e09\u3001\u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\u914d\u7f6e&#xff08;\u5b98\u65b9\u6807\u51c6&#xff09;<\/h3>\n<h4>1. \u914d\u7f6e\u5168\u5c40\u94a9\u5b50\u76ee\u5f55<\/h4>\n<p>\u5728 \/etc\/gitlab\/gitlab.rb \u4e2d\u914d\u7f6e&#xff1a;<\/p>\n<p>gitaly<span class=\"token punctuation\">[<\/span><span class=\"token string-literal\"><span class=\"token string\">&#039;configuration&#039;<\/span><\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token symbol\">:hooks<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token symbol\">:custom_hooks_dir<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token string-literal\"><span class=\"token string\">&#039;\/var\/opt\/gitlab\/gitaly\/custom_hooks&#039;<\/span><\/span><\/p>\n<p>\u5b98\u65b9\u9ed8\u8ba4\u63a8\u8350\u76ee\u5f55&#xff1a;<br \/>\n\/var\/opt\/gitlab\/gitaly\/custom_hooks<\/p>\n<h4>2. \u521b\u5efa\u76ee\u5f55\u7ed3\u6784<\/h4>\n<p>\u5fc5\u987b\u6309\u94a9\u5b50\u7c7b\u578b\u521b\u5efa .d \u76ee\u5f55&#xff1a;<\/p>\n<p><span class=\"token function\">mkdir<\/span> <span class=\"token parameter variable\">-p<\/span> \/var\/opt\/gitlab\/gitaly\/custom_hooks\/pre-receive.d<\/p>\n<h4>3. \u653e\u7f6e\u94a9\u5b50\u811a\u672c<\/h4>\n<ul>\n<li>\u76ee\u5f55&#xff1a;pre-receive.d\/<\/li>\n<li>\u6587\u4ef6\u540d&#xff1a;\u4efb\u610f\u53ef\u6267\u884c\u6587\u4ef6&#xff08;\u65e0\u540e\u7f00\u8981\u6c42&#xff09;<\/li>\n<li>\u9996\u884c\u5fc5\u987b\u6307\u5b9a\u89e3\u91ca\u5668&#xff1a;#!\/bin\/bash<\/li>\n<\/ul>\n<h4>4. \u6743\u9650\u914d\u7f6e&#xff08;\u5173\u952e&#xff09;<\/h4>\n<p><span class=\"token function\">chmod<\/span> &#043;x \/var\/opt\/gitlab\/gitaly\/custom_hooks\/pre-receive.d\/*.sh<br \/>\n<span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> git:git \/var\/opt\/gitlab\/gitaly\/custom_hooks<br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token parameter variable\">-R<\/span> <span class=\"token number\">755<\/span> \/var\/opt\/gitlab\/gitaly\/custom_hooks<\/p>\n<h4>5. \u91cd\u8f7d\u751f\u6548<\/h4>\n<p>gitlab-ctl reconfigure<br \/>\ngitlab-ctl restart gitaly<\/p>\n<hr \/>\n<h3>\u56db\u3001\u6267\u884c\u987a\u5e8f\u4e0e\u89c4\u5219<\/h3>\n<li>\u4f18\u5148\u6267\u884c GitLab \u5185\u7f6e\u94a9\u5b50<\/li>\n<li>\u6267\u884c\u9879\u76ee\u7ea7\u94a9\u5b50&#xff1a;repo.git\/custom_hooks\/pre-receive.d\/*<\/li>\n<li>\u6267\u884c\u5168\u5c40\u94a9\u5b50&#xff1a;custom_hooks_dir\/pre-receive.d\/*<\/li>\n<li>\u6309\u6587\u4ef6\u540d\u5b57\u6bcd\u5e8f\u6267\u884c<\/li>\n<li>\u4efb\u610f\u94a9\u5b50 exit 1 \u5373\u4e2d\u65ad\u63a8\u9001<\/li>\n<hr \/>\n<h3>\u4e94\u3001\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf<\/h3>\n<h4>GitLab \u5185\u7f6e\u53d8\u91cf<\/h4>\n<table>\n<tr>\u53d8\u91cf\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>GL_ID<\/td>\n<td>\u64cd\u4f5c\u7528\u6237\/key \u6807\u8bc6&#xff08;user-123 \/ key-456&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>GL_USERNAME<\/td>\n<td>GitLab \u7528\u6237\u540d<\/td>\n<\/tr>\n<tr>\n<td>GL_PROJECT_PATH<\/td>\n<td>\u9879\u76ee\u8def\u5f84<\/td>\n<\/tr>\n<tr>\n<td>GL_REPOSITORY<\/td>\n<td>\u9879\u76ee ID&#xff08;project-1234&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>GL_PROTOCOL<\/td>\n<td>\u534f\u8bae&#xff1a;ssh \/ http \/ web<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Git \u5185\u7f6e\u53d8\u91cf<\/h4>\n<ul>\n<li>GIT_OBJECT_DIRECTORY<\/li>\n<li>GIT_ALTERNATE_OBJECT_DIRECTORIES<\/li>\n<li>GIT_PUSH_OPTION_COUNT<\/li>\n<\/ul>\n<hr \/>\n<h3>\u516d\u3001\u81ea\u5b9a\u4e49\u9519\u8bef\u4fe1\u606f\u89c4\u8303<\/h3>\n<p>\u4e3a\u5728\u7ec8\u7aef\u4e0e Web \u7aef\u6e05\u6670\u5c55\u793a\u9519\u8bef&#xff0c;\u5fc5\u987b\u4f7f\u7528\u5b98\u65b9\u524d\u7f00&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;GL-HOOK-ERR: \u4ec5\u5141\u8bb8\u521b\u5efa main \u548c dev \u5206\u652f&#xff01;&#034;<\/span><\/p>\n<hr \/>\n<h3>\u4e03\u3001\u6700\u4f73\u5b9e\u8df5&#xff1a;\u5206\u652f\u786c\u9650\u5236\u811a\u672c&#xff08;\u751f\u4ea7\u53ef\u7528&#xff09;<\/h3>\n<h4>\u76ee\u6807<\/h4>\n<p>\u5168\u5c40\u5f3a\u5236\u4ed3\u5e93\u4ec5\u5141\u8bb8 main &#043; dev \u4e24\u4e2a\u5206\u652f&#xff0c;\u7981\u6b62\u521b\u5efa\u4efb\u4f55\u5176\u4ed6\u5206\u652f\u3002<\/p>\n<h4>\u811a\u672c\u8def\u5f84<\/h4>\n<p>\/var\/opt\/gitlab\/gitaly\/custom_hooks\/pre-receive.d\/branch-restrict.sh<\/p>\n<h4>\u811a\u672c\u5185\u5bb9<\/h4>\n<p><span class=\"token shebang important\">#!\/bin\/bash<\/span><br \/>\n<span class=\"token keyword\">while<\/span> <span class=\"token builtin class-name\">read<\/span> oldrev newrev refname<span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">do<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">[<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$oldrev<\/span>&#034;<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;0000000000000000000000000000000000000000&#034;<\/span> <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">[<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$refname<\/span>&#034;<\/span> <span class=\"token operator\">!&#061;<\/span> <span class=\"token string\">&#034;refs\/heads\/main&#034;<\/span> <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$refname<\/span>&#034;<\/span> <span class=\"token operator\">!&#061;<\/span> <span class=\"token string\">&#034;refs\/heads\/dev&#034;<\/span> <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n            <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;GL-HOOK-ERR: \u7981\u6b62\u521b\u5efa\u5206\u652f&#xff01;\u4ec5\u5141\u8bb8 main \u548c dev \u5206\u652f\u3002&#034;<\/span><br \/>\n            <span class=\"token builtin class-name\">exit<\/span> <span class=\"token number\">1<\/span><br \/>\n        <span class=\"token keyword\">fi<\/span><br \/>\n    <span class=\"token keyword\">fi<\/span><br \/>\n<span class=\"token keyword\">done<\/span><br \/>\n<span class=\"token builtin class-name\">exit<\/span> <span class=\"token number\">0<\/span><\/p>\n<h5>\u7fa4\u7ec4\u9650\u5236<\/h5>\n<p><span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/var\/opt\/gitlab\/gitaly\/custom_hooks\/pre-receive.d\/branch-group-restrict.sh <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#039;EOF&#039;<br \/>\n#!\/bin\/bash<\/p>\n<p># GitLab \u5168\u5c40\u5206\u652f\u9650\u5236\u7b56\u7565<br \/>\n# \u89c4\u5219&#xff1a;<br \/>\n# 1. \u4e2a\u4eba\u547d\u540d\u7a7a\u95f4&#xff08;username\/*&#xff09;&#xff1a;\u4e0d\u9650\u5236&#xff0c;\u53ef\u81ea\u7531\u521b\u5efa\u5206\u652f<br \/>\n# 2. \u7fa4\u7ec4\u547d\u540d\u7a7a\u95f4&#xff08;group\/*&#xff09;&#xff1a;\u4ec5\u5141\u8bb8 main \u548c dev \u5206\u652f<\/p>\n<p># \u83b7\u53d6\u73af\u5883\u53d8\u91cf&#xff08;GitLab \u81ea\u52a8\u6ce8\u5165&#xff09;<br \/>\nPROJECT_PATH&#061;&#034;$GL_PROJECT_PATH&#034;<br \/>\nUSERNAME&#061;&#034;$GL_USERNAME&#034;<\/p>\n<p># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u6838\u5fc3\u903b\u8f91 &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n# \u5982\u679c\u662f\u3010\u4e2a\u4eba\u4ed3\u5e93\u3011 \u2192 \u76f4\u63a5\u653e\u884c<br \/>\n# \u903b\u8f91&#xff1a;\u5224\u65ad\u8def\u5f84\u662f\u5426\u4ee5 &#034;\u7528\u6237\u540d\/&#034; \u5f00\u5934<br \/>\nif [[ &#034;$PROJECT_PATH&#034; &#061;&#061; &#034;${USERNAME}\/&#034;* ]]; then<br \/>\n    exit 0<br \/>\nfi<\/p>\n<p># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u7fa4\u7ec4\u4ed3\u5e93\u5206\u652f\u9650\u5236 &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\nwhile read -r oldrev newrev refname; do<br \/>\n    # \u4ec5\u62e6\u622a&#xff1a;\u521b\u5efa\u65b0\u5206\u652f&#xff08;oldrev \u4e3a\u5168 0&#xff09;<br \/>\n    if [[ &#034;$oldrev&#034; &#061;&#061; &#034;0000000000000000000000000000000000000000&#034; ]]; then<br \/>\n        # \u5206\u652f\u767d\u540d\u5355\u6821\u9a8c<br \/>\n        if [[ &#034;$refname&#034; !&#061; &#034;refs\/heads\/main&#034; &amp;&amp; &#034;$refname&#034; !&#061; &#034;refs\/heads\/dev&#034; ]]; then<br \/>\n            echo &#034;GL-HOOK-ERR: [\u7ec4\u7ec7\u5408\u89c4] \u7fa4\u7ec4\u4ed3\u5e93\u4ec5\u5141\u8bb8\u4f7f\u7528 main \/ dev \u5206\u652f&#xff0c;\u7981\u6b62\u521b\u5efa\u81ea\u5b9a\u4e49\u5206\u652f&#xff01;&#034;<br \/>\n            exit 1<br \/>\n        fi<br \/>\n    fi<br \/>\ndone<\/p>\n<p>exit 0<br \/>\nEOF<\/span><\/p>\n<h5>\u767d\u540d\u5355\u6a21\u5f0f<\/h5>\n<p><span class=\"token shebang important\">#!\/bin\/bash<\/span><\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token comment\"># \u914d\u7f6e\u533a<\/span><br \/>\n<span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span class=\"token comment\"># \u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\u9876\u7ea7\u7fa4\u7ec4&#xff0c;\u66f4\u9ad8\u6548\u4e14\u6613\u8bfb<\/span><br \/>\n<span class=\"token comment\"># \u5339\u914d ros, hardware, tools, web, algo \u4e0b\u7684\u6240\u6709\u5b50\u8def\u5f84<\/span><br \/>\n<span class=\"token assign-left variable\">LIMIT_GROUPS_REGEX<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;^(ros|hardware|tools|web|algo)\/&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u5141\u8bb8\u7684\u5206\u652f&#xff08;\u4f7f\u7528\u6570\u7ec4\u914d\u5408\u6b63\u5219\u5224\u65ad&#xff09;<\/span><br \/>\n<span class=\"token assign-left variable\">ALLOWED_BRANCHES_REGEX<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;^(main|dev)$&#034;<\/span><\/p>\n<p><span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/span><br \/>\n<span class=\"token comment\"># \u6838\u5fc3\u903b\u8f91<\/span><br \/>\n<span class=\"token comment\"># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span class=\"token comment\"># \u83b7\u53d6\u73af\u5883\u53d8\u91cf<\/span><br \/>\n<span class=\"token assign-left variable\">PROJECT<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;<span class=\"token variable\">$GL_PROJECT_PATH<\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 1. \u5feb\u901f\u5224\u5b9a&#xff1a;\u662f\u5426\u5728\u9650\u5236\u540d\u5355\u5185<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">[<\/span> <span class=\"token operator\">!<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$PROJECT<\/span>&#034;<\/span> <span class=\"token operator\">&#061;~<\/span> <span class=\"token variable\">$LIMIT_GROUPS_REGEX<\/span> <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n    <span class=\"token builtin class-name\">exit<\/span> <span class=\"token number\">0<\/span><br \/>\n<span class=\"token keyword\">fi<\/span><\/p>\n<p><span class=\"token comment\"># 2. \u5faa\u73af\u5904\u7406\u63a8\u9001\u6d41&#xff08;\u6807\u51c6\u8f93\u5165\u83b7\u53d6 oldrev, newrev, refname&#xff09;<\/span><br \/>\n<span class=\"token keyword\">while<\/span> <span class=\"token builtin class-name\">read<\/span> <span class=\"token parameter variable\">-r<\/span> oldrev newrev refname<span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">do<\/span><\/p>\n<p>    <span class=\"token comment\"># \u4ec5\u5904\u7406\u3010\u5206\u652f\u3011\u5f15\u7528 (refs\/heads\/)&#xff0c;\u5ffd\u7565 Tags \u6216\u5176\u4ed6<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">[<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$refname<\/span>&#034;<\/span> <span class=\"token operator\">!&#061;<\/span> refs\/heads\/* <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n        <span class=\"token builtin class-name\">continue<\/span><br \/>\n    <span class=\"token keyword\">fi<\/span><\/p>\n<p>    <span class=\"token comment\"># 3. \u5224\u5b9a\u662f\u5426\u4e3a\u3010\u65b0\u5efa\u5206\u652f\u3011\u52a8\u4f5c (oldrev \u4e3a\u5168 0)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">[<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$oldrev<\/span>&#034;<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token string\">&#034;0000000000000000000000000000000000000000&#034;<\/span> <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><\/p>\n<p>        <span class=\"token comment\"># \u63d0\u53d6\u5206\u652f\u77ed\u540d\u79f0<\/span><br \/>\n        <span class=\"token assign-left variable\">branch<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;<span class=\"token variable\">${refname<span class=\"token operator\">#<\/span>refs<span class=\"token operator\">\/<\/span>heads<span class=\"token operator\">\/<\/span>}<\/span>&#034;<\/span><\/p>\n<p>        <span class=\"token comment\"># 4. \u6821\u9a8c\u5206\u652f\u540d\u662f\u5426\u7b26\u5408\u5141\u8bb8\u7684\u6b63\u5219<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">[<\/span> <span class=\"token operator\">!<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$branch<\/span>&#034;<\/span> <span class=\"token operator\">&#061;~<\/span> <span class=\"token variable\">$ALLOWED_BRANCHES_REGEX<\/span> <span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n            <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;<\/span><br \/>\n            <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;GL-HOOK-ERR: \u274c [\u7ec4\u7ec7\u5408\u89c4\u6027\u62e6\u622a]&#034;<\/span><br \/>\n            <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u9879\u76ee\u8def\u5f84: <span class=\"token variable\">$PROJECT<\/span>&#034;<\/span><br \/>\n            <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u9519\u8bef\u539f\u56e0: \u8be5\u4e1a\u52a1\u7fa4\u7ec4\u53d7\u9650&#xff0c;\u7981\u6b62\u521b\u5efa\u81ea\u5b9a\u4e49\u5206\u652f &#039;<span class=\"token variable\">$branch<\/span>&#039;&#034;<\/span><br \/>\n            <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u5141\u8bb8\u5206\u652f: main, dev&#034;<\/span><br \/>\n            <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;<\/span><br \/>\n            <span class=\"token builtin class-name\">exit<\/span> <span class=\"token number\">1<\/span><br \/>\n        <span class=\"token keyword\">fi<\/span><br \/>\n    <span class=\"token keyword\">fi<\/span><br \/>\n<span class=\"token keyword\">done<\/span><\/p>\n<p><span class=\"token builtin class-name\">exit<\/span> <span class=\"token number\">0<\/span><\/p>\n<hr \/>\n<h3>\u516b\u3001\u5e38\u89c1\u95ee\u9898\u6392\u67e5<\/h3>\n<h4>1. \u94a9\u5b50\u4e0d\u751f\u6548<\/h4>\n<ul>\n<li>\u76ee\u5f55\u662f\u5426\u4e3a custom_hooks\/pre-receive.d<\/li>\n<li>\u6743\u9650\u662f\u5426\u4e3a git:git &#043; chmod &#043;x<\/li>\n<li>\u662f\u5426\u91cd\u542f gitaly<\/li>\n<li>\u662f\u5426\u5728 gitlab.rb \u6b63\u786e\u914d\u7f6e custom_hooks_dir<\/li>\n<\/ul>\n<h4>2. pre-receive hook declined<\/h4>\n<ul>\n<li>\u67e5\u770b\u94a9\u5b50\u8f93\u51fa\u9519\u8bef\u4fe1\u606f<\/li>\n<li>\u67e5\u770b Gitaly \u65e5\u5fd7&#xff1a;<span class=\"token function\">grep<\/span> PreReceiveHook \/var\/log\/gitlab\/gitaly\/current\n<\/li>\n<\/ul>\n<h4>3. SSH \u4e0d\u89e6\u53d1\u3001HTTP \u89e6\u53d1<\/h4>\n<ul>\n<li>\u65b0\u7248 GitLab \u7edf\u4e00\u8d70 Gitaly Hooks&#xff0c;SSH\/HTTP \u8868\u73b0\u4e00\u81f4<\/li>\n<li>\u786e\u8ba4\u4f7f\u7528\u5168\u5c40 Gitaly \u94a9\u5b50&#xff0c;\u800c\u975e\u65e7\u7248 git-shell \u76ee\u5f55<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e5d\u3001\u603b\u7ed3&#xff08;\u53ef\u76f4\u63a5\u7528\u4e8e\u6280\u672f\u89c4\u8303\u6587\u6863&#xff09;<\/h3>\n<li>GitLab 18.9 \u5168\u5c40\u670d\u52a1\u7aef\u94a9\u5b50\u552f\u4e00\u6807\u51c6\u76ee\u5f55&#xff1a;<br \/>\n\/var\/opt\/gitlab\/gitaly\/custom_hooks<\/li>\n<li>\u5fc5\u987b\u4f7f\u7528 .d \u76ee\u5f55\u7ed3\u6784\u5b58\u653e\u94a9\u5b50<\/li>\n<li>\u6743\u9650\u5fc5\u987b\u662f git:git &#043; \u53ef\u6267\u884c<\/li>\n<li>\u5206\u652f\u9650\u5236\u63a8\u8350\u4f7f\u7528\u767d\u540d\u5355\u6a21\u5f0f&#xff08;\u4ec5\u5141\u8bb8 main\/dev&#xff09;<\/li>\n<li>\u9519\u8bef\u4fe1\u606f\u5fc5\u987b\u4ee5 GL-HOOK-ERR: \u5f00\u5934<\/li>\n<li>\u914d\u7f6e\u5b8c\u6210\u9700\u91cd\u542f gitaly \u751f\u6548<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u6863\u6765\u6e90&#xff1a;https:\/\/archives.docs.gitlab.com\/18.9\/administration\/server_hooks\/?tabLinuxpackage%28Omnibus%29\u4e00\u3001\u6982\u8ff0<br \/>\nGit Server Hooks \u662f\u8fd0\u884c\u5728 GitLab \u670d\u52a1\u7aef\u7684\u81ea\u5b9a\u4e49\u903b\u8f91&#xff0c;\u53ef\u7528\u4e8e\u63d0\u4ea4\u89c4\u8303\u6821\u9a8c\u3001\u5206\u652f\u6743\u9650\u63a7\u5236\u3001\u72b6\u6001\u89e6\u53d1\u4efb\u52a1\u7b49\u3002<br \/>\n\u652f\u6301\u4e09\u79cd\u6807\u51c6 Git \u94a9\u5b50&#xff1a;<br \/>\npre-receive&#xff1a;\u63a5\u6536\u63a8\u9001\u524d\u6267\u884c&#xff0c;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[89,273,43],"topic":[],"class_list":["post-104711","post","type-post","status-publish","format-standard","hentry","category-server","tag-git","tag-gitlab","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5 - \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\/104711.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u6863\u6765\u6e90&#xff1a;https:\/\/archives.docs.gitlab.com\/18.9\/administration\/server_hooks\/?tabLinuxpackage%28Omnibus%29\u4e00\u3001\u6982\u8ff0 Git Server Hooks \u662f\u8fd0\u884c\u5728 GitLab \u670d\u52a1\u7aef\u7684\u81ea\u5b9a\u4e49\u903b\u8f91&#xff0c;\u53ef\u7528\u4e8e\u63d0\u4ea4\u89c4\u8303\u6821\u9a8c\u3001\u5206\u652f\u6743\u9650\u63a7\u5236\u3001\u72b6\u6001\u89e6\u53d1\u4efb\u52a1\u7b49\u3002 \u652f\u6301\u4e09\u79cd\u6807\u51c6 Git \u94a9\u5b50&#xff1a; pre-receive&#xff1a;\u63a5\u6536\u63a8\u9001\u524d\u6267\u884c&#xff0c;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/104711.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-12T20:09:03+00:00\" \/>\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\/104711.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/104711.html\",\"name\":\"\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-12T20:09:03+00:00\",\"dateModified\":\"2026-09-12T20:09:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/104711.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/104711.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/104711.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5\"}]},{\"@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":"\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5 - \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\/104711.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u6863\u6765\u6e90&#xff1a;https:\/\/archives.docs.gitlab.com\/18.9\/administration\/server_hooks\/?tabLinuxpackage%28Omnibus%29\u4e00\u3001\u6982\u8ff0 Git Server Hooks \u662f\u8fd0\u884c\u5728 GitLab \u670d\u52a1\u7aef\u7684\u81ea\u5b9a\u4e49\u903b\u8f91&#xff0c;\u53ef\u7528\u4e8e\u63d0\u4ea4\u89c4\u8303\u6821\u9a8c\u3001\u5206\u652f\u6743\u9650\u63a7\u5236\u3001\u72b6\u6001\u89e6\u53d1\u4efb\u52a1\u7b49\u3002 \u652f\u6301\u4e09\u79cd\u6807\u51c6 Git \u94a9\u5b50&#xff1a; pre-receive&#xff1a;\u63a5\u6536\u63a8\u9001\u524d\u6267\u884c&#xff0c;","og_url":"https:\/\/www.wsisp.com\/helps\/104711.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-12T20:09:03+00:00","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\/104711.html","url":"https:\/\/www.wsisp.com\/helps\/104711.html","name":"\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-12T20:09:03+00:00","dateModified":"2026-09-12T20:09:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/104711.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/104711.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/104711.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010Git\u3011GitLab 18.9 \u5168\u5c40\u670d\u52a1\u5668\u94a9\u5b50\uff08Server Hooks\uff09\u5b98\u65b9\u89c4\u8303\u4e0e\u843d\u5730\u5b9e\u8df5"}]},{"@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\/104711","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=104711"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/104711\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=104711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=104711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=104711"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=104711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}