{"id":20159,"date":"2024-11-19T11:32:29","date_gmt":"2024-11-19T03:32:29","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20159\/"},"modified":"2024-11-19T11:32:29","modified_gmt":"2024-11-19T03:32:29","slug":"gitlab%e5%ae%89%e8%a3%85%e5%90%8e%e6%97%a0root%e7%94%a8%e6%88%b7%e5%90%8d%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20159\/","title":{"rendered":"gitlab\u5b89\u88c5\u540e\u65e0root\u7528\u6237\u540d\u5bc6\u7801"},"content":{"rendered":"<p>gitlab\u662f\u4e00\u4e2a\u57fa\u4e8eweb\u7684git\u4ed3\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u63d0\u4f9b\u4e86\u4ee3\u7801\u7ba1\u7406\u3001issue\u8ddf\u8e2a\u3001ci\/cd\u7b49\u529f\u80fd\uff0c\u975e\u5e38\u9002\u7528\u4e8e\u56e2\u961f\u534f\u4f5c\u5f00\u53d1\u3002\u4f46\u662f\uff0c\u5728\u5b89\u88c5gitlab\u540e\uff0c\u6709\u65f6\u5019\u4f1a\u51fa\u73b0\u65e0\u6cd5\u767b\u9646\u7684\u60c5\u51b5\uff0c\u63d0\u793a\u65e0root\u7528\u6237\u540d\u5bc6\u7801\uff0c\u4e0b\u9762\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<p>1.\u786e\u8ba4\u662f\u5426\u5b89\u88c5\u5b8c\u6210<\/p>\n<p>\u9996\u5148\uff0c\u786e\u8ba4GitLab\u662f\u5426\u5b89\u88c5\u5b8c\u6210\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0cGitLab\u4f1a\u521b\u5efa\u4e00\u4e2aroot\u7528\u6237\uff0c\u5e76\u4e14\u4f1a\u63d0\u793a\u4f60\u8bbe\u7f6eroot\u7684\u5bc6\u7801\u3002\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u5e94\u8be5\u53ef\u4ee5\u901a\u8fc7\u7528\u6237\u540droot\u4ee5\u53ca\u521a\u521a\u8bbe\u7f6e\u7684\u5bc6\u7801\u6765\u767b\u9646GitLab\u3002\u5982\u679c\u65e0\u6cd5\u767b\u9646\uff0c\u90a3\u4e48\u6709\u53ef\u80fd\u662f\u5b89\u88c5\u6ca1\u6709\u5b8c\u6210\u6216\u51fa\u73b0\u4e86\u5176\u4ed6\u95ee\u9898\u3002<\/p>\n<p>2.\u67e5\u770bGitLab\u7684\u72b6\u6001<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u68c0\u67e5GitLab\u7684\u72b6\u6001\u3002\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u68c0\u67e5\uff1a<\/p>\n<p>sudo gitlab-ctl status<\/p>\n<p>\u5982\u679c\u6240\u6709\u7684\u670d\u52a1\u90fd\u8fd0\u884c\u6b63\u5e38\uff0c\u90a3\u4e48\u8fd9\u4e2aGitLab\u5b9e\u4f8b\u5e94\u8be5\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\u3002\u4f46\u662f\u5982\u679c\u53d1\u73b0\u67d0\u4e9b\u670d\u52a1\u6ca1\u6709\u8fd0\u884c\u6b63\u5e38\uff0c\u90a3\u4e48\u6211\u4eec\u9700\u8981\u91cd\u542f\u5b83\u4eec\u3002\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u91cd\u542f\u6240\u6709\u7684\u670d\u52a1\uff1a<\/p>\n<p>sudo gitlab-ctl restart<\/p>\n<p>3.\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801<\/p>\n<p>\u5982\u679cGitLab\u7684\u72b6\u6001\u6b63\u5e38\uff0c\u90a3\u4e48\u8bf4\u660e\u51fa\u73b0\u95ee\u9898\u7684\u5f88\u53ef\u80fd\u662froot\u7528\u6237\u7684\u5bc6\u7801\u3002\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u91cd\u7f6eroot\u7528\u6237\u7684\u5bc6\u7801\uff1a<\/p>\n<p>sudo gitlab-rake &#8220;gitlab:password:reset&#8221;<\/p>\n<p>\u6267\u884c\u5b8c\u8fd9\u4e2a\u547d\u4ee4\u540e\uff0cGitLab\u4f1a\u63d0\u793a\u4f60\u8981\u91cd\u7f6e\u54ea\u4e2a\u7528\u6237\u7684\u5bc6\u7801\u3002\u5728\u8fd9\u91cc\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u91cd\u7f6eroot\u7528\u6237\u7684\u5bc6\u7801\u3002\u8f93\u5165root\u7684\u540d\u79f0\uff0c\u6309\u4e0bEnter\u952e\uff0cGitLab\u4f1a\u968f\u673a\u751f\u6210\u4e00\u4e2a\u5bc6\u7801\uff0c\u7136\u540e\u5c06\u8fd9\u4e2a\u5bc6\u7801\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002<\/p>\n<p>4.\u5c1d\u8bd5\u4f7f\u7528\u65b0\u5bc6\u7801\u767b\u5f55<\/p>\n<p>\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u521a\u624d\u751f\u6210\u7684\u65b0\u5bc6\u7801\uff0c\u4ee5root\u7528\u6237\u8eab\u4efd\u767b\u9646GitLab\u3002\u5982\u679c\u8fd8\u662f\u65e0\u6cd5\u767b\u9646\uff0c\u90a3\u4e48\u53ef\u80fd\u662f\u5b89\u88c5\u51fa\u73b0\u4e86\u5176\u4ed6\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u65b0\u5b89\u88c5GitLab\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u89e3\u51b3GitLab\u5b89\u88c5\u540e\u65e0root\u7528\u6237\u540d\u5bc6\u7801\u7684\u65b9\u6cd5\uff0c\u8fd9\u662f\u4e00\u4e2a\u6bd4\u8f83\u5e38\u89c1\u7684\u95ee\u9898\u3002\u5728\u4f7f\u7528GitLab\u65f6\uff0c\u6211\u4eec\u9700\u8981\u4ed4\u7ec6\u68c0\u67e5\u6bcf\u4e2a\u6b65\u9aa4\uff0c\u4ee5\u786e\u4fddGitLab\u80fd\u591f\u6b63\u786e\u5de5\u4f5c\u3002\u5982\u679c\u8fd8\u6709\u5176\u4ed6\u95ee\u9898\uff0c\u53ef\u4ee5\u67e5\u770bGitLab\u7684\u5b98\u65b9\u6587\u6863\u6216\u8005\u8bbf\u95eeGitLab\u7684\u793e\u533a\u652f\u6301\u7f51\u7ad9\u6765\u83b7\u53d6\u5e2e\u52a9\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fgitlab\u5b89\u88c5\u540e\u65e0root\u7528\u6237\u540d\u5bc6\u7801\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>gitlab\u662f\u4e00\u4e2a\u57fa\u4e8eweb\u7684git\u4ed3\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u63d0\u4f9b\u4e86\u4ee3\u7801\u7ba1\u7406\u3001issue\u8ddf\u8e2a\u3001ci\/cd\u7b49\u529f\u80fd\uff0c\u975e\u5e38\u9002\u7528\u4e8e\u56e2\u961f\u534f\u4f5c\u5f00\u53d1\u3002\u4f46\u662f\uff0c\u5728\u5b89\u88c5gitlab\u540e\uff0c\u6709\u65f6\u5019\u4f1a\u51fa\u73b0\u65e0\u6cd5\u767b\u9646\u7684\u60c5\u51b5\uff0c\u63d0\u793a\u65e0root\u7528\u6237\u540d\u5bc6\u7801\uff0c\u4e0b\u9762\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002 1.\u786e\u8ba4\u662f\u5426\u5b89\u88c5\u5b8c\u6210 \u9996\u5148\uff0c\u786e\u8ba4GitLab\u662f\u5426\u5b89\u88c5\u5b8c\u6210\u3002\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0cGitLab\u4f1a\u521b\u5efa\u4e00\u4e2aroot\u7528\u6237\uff0c\u5e76\u4e14\u4f1a\u63d0\u793a\u4f60\u8bbe\u7f6eroot\u7684\u5bc6\u7801\u3002\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u5e94\u8be5\u53ef\u4ee5\u901a\u8fc7\u7528\u6237\u540droot\u4ee5\u53ca\u521a\u521a\u8bbe\u7f6e\u7684\u5bc6\u7801\u6765\u767b\u9646GitLab\u3002\u5982\u679c\u65e0\u6cd5\u767b\u9646\uff0c\u90a3\u4e48\u6709\u53ef\u80fd\u662f\u5b89\u88c5\u6ca1\u6709\u5b8c\u6210\u6216\u51fa\u73b0\u4e86\u5176\u4ed6\u95ee\u9898\u3002 2.\u67e5\u770bGitLab\u7684\u72b6\u6001 \u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u68c0\u67e5GitLab\u7684\u72b6\u6001\u3002\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u68c0\u67e5\uff1a sudo gitlab-ctl status \u5982\u679c\u6240\u6709\u7684\u670d\u52a1\u90fd\u8fd0\u884c\u6b63\u5e38\uff0c\u90a3\u4e48\u8fd9\u4e2aGitLab\u5b9e\u4f8b\u5e94\u8be5\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\u3002\u4f46\u662f\u5982\u679c\u53d1\u73b0\u67d0\u4e9b\u670d\u52a1\u6ca1\u6709\u8fd0\u884c\u6b63\u5e38\uff0c\u90a3\u4e48\u6211\u4eec\u9700\u8981\u91cd\u542f\u5b83\u4eec\u3002\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u91cd\u542f\u6240\u6709\u7684\u670d\u52a1\uff1a sudo gitlab-ctl restart 3.\u91cd\u7f6eroot\u7528\u6237\u5bc6\u7801 \u5982\u679cGitLab\u7684\u72b6\u6001\u6b63\u5e38\uff0c\u90a3\u4e48\u8bf4\u660e\u51fa\u73b0\u95ee\u9898\u7684\u5f88\u53ef\u80fd\u662froot\u7528\u6237\u7684\u5bc6\u7801\u3002\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u91cd\u7f6eroot\u7528\u6237\u7684\u5bc6\u7801\uff1a sudo gitlab-rake &#8220;gitlab:password:reset&#8221; \u6267\u884c\u5b8c\u8fd9\u4e2a\u547d\u4ee4\u540e\uff0cGitLab\u4f1a\u63d0\u793a\u4f60\u8981\u91cd\u7f6e\u54ea\u4e2a\u7528\u6237\u7684\u5bc6\u7801\u3002\u5728\u8fd9\u91cc\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u91cd\u7f6eroot\u7528\u6237\u7684\u5bc6\u7801\u3002\u8f93\u5165root\u7684\u540d\u79f0\uff0c\u6309\u4e0bEnter\u952e\uff0cGitLab\u4f1a\u968f\u673a\u751f\u6210\u4e00\u4e2a\u5bc6\u7801\uff0c\u7136\u540e\u5c06\u8fd9\u4e2a\u5bc6\u7801\u663e\u793a\u5728\u7ec8\u7aef\u4e0a\u3002 4.\u5c1d\u8bd5\u4f7f\u7528\u65b0\u5bc6\u7801\u767b\u5f55 \u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u521a\u624d\u751f\u6210\u7684\u65b0\u5bc6\u7801\uff0c\u4ee5root\u7528\u6237\u8eab\u4efd\u767b\u9646GitLab\u3002\u5982\u679c\u8fd8\u662f\u65e0\u6cd5\u767b\u9646\uff0c\u90a3\u4e48\u53ef\u80fd\u662f\u5b89\u88c5\u51fa\u73b0\u4e86\u5176\u4ed6\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u65b0\u5b89\u88c5GitLab\u3002 \u603b\u7ed3 \u4ee5\u4e0a\u5c31\u662f\u89e3\u51b3GitLab\u5b89\u88c5\u540e\u65e0root\u7528\u6237\u540d\u5bc6\u7801\u7684\u65b9\u6cd5\uff0c\u8fd9\u662f\u4e00\u4e2a\u6bd4\u8f83\u5e38\u89c1\u7684\u95ee\u9898\u3002\u5728\u4f7f\u7528GitLab\u65f6\uff0c\u6211\u4eec\u9700\u8981\u4ed4\u7ec6\u68c0\u67e5\u6bcf\u4e2a\u6b65\u9aa4\uff0c\u4ee5\u786e\u4fddGitLab\u80fd\u591f\u6b63\u786e\u5de5\u4f5c\u3002\u5982\u679c\u8fd8\u6709\u5176\u4ed6\u95ee\u9898\uff0c\u53ef\u4ee5\u67e5\u770bGitLab\u7684\u5b98\u65b9\u6587\u6863\u6216\u8005\u8bbf\u95eeGitLab\u7684\u793e\u533a\u652f\u6301\u7f51\u7ad9\u6765\u83b7\u53d6\u5e2e\u52a9\u3002 \u4ee5\u4e0a\u5c31\u662fgitlab\u5b89\u88c5\u540e\u65e0root\u7528\u6237\u540d\u5bc6\u7801\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-20159","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=20159"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20159\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}