{"id":21570,"date":"2024-11-19T14:54:08","date_gmt":"2024-11-19T06:54:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21570\/"},"modified":"2024-11-19T14:54:08","modified_gmt":"2024-11-19T06:54:08","slug":"%e6%80%8e%e4%b9%88%e6%9f%a5%e7%9c%8bgit%e7%9a%84%e9%85%8d%e7%bd%ae%e4%bf%a1%e6%81%af","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21570\/","title":{"rendered":"\u600e\u4e48\u67e5\u770bgit\u7684\u914d\u7f6e\u4fe1\u606f"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u67e5\u770b git \u914d\u7f6e\u4fe1\u606f\u4f7f\u7528 git config \u547d\u4ee4\uff1a\u5217\u51fa\u6240\u6709\u5df2\u914d\u7f6e\u7684\u8bbe\u7f6e\uff08\u65b9\u6cd5 1\uff09\u3002\u67e5\u770b\u7279\u5b9a\u914d\u7f6e\u9879\uff1a\u6307\u5b9a\u9009\u9879\u548c\u914d\u7f6e\u952e\uff08\u65b9\u6cd5 2\uff09\u3002\u4f7f\u7528 git var \u547d\u4ee4\uff1a\u67e5\u770b git \u5185\u90e8\u53d8\u91cf\uff08\u65b9\u6cd5 3\uff09\u3002git \u914d\u7f6e\u4fe1\u606f\u7c7b\u578b\uff1a\u5168\u5c40\u3001\u7528\u6237\u3001\u672c\u5730\uff0c\u6309\u6b64\u987a\u5e8f\u8986\u76d6\u914d\u7f6e\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/31\/2024053100160910707.jpg\" class=\"aligncenter\" title=\"\u600e\u4e48\u67e5\u770bgit\u7684\u914d\u7f6e\u4fe1\u606f\u63d2\u56fe\" alt=\"\u600e\u4e48\u67e5\u770bgit\u7684\u914d\u7f6e\u4fe1\u606f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b Git \u914d\u7f6e\u4fe1\u606f<\/strong><\/p>\n<p><strong>\u65b9\u6cd5 1\uff1a\u4f7f\u7528  config \u547d\u4ee4<\/strong><\/p>\n<p>\u6700\u76f4\u63a5\u67e5\u770b Git \u914d\u7f6e\u4fe1\u606f\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 git config \u547d\u4ee4\u3002\u8be5\u547d\u4ee4\u4f1a\u5217\u51fa\u6240\u6709\u5df2\u914d\u7f6e\u7684\u8bbe\u7f6e\uff0c\u5305\u62ec\u7528\u6237\u7ea7\u548c\u7cfb\u7edf\u7ea7\u8bbe\u7f6e\u3002<\/p>\n<pre>$ git config --list<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u65b9\u6cd5 2\uff1a\u67e5\u770b\u7279\u5b9a\u914d\u7f6e\u9879<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u7279\u5b9a\u914d\u7f6e\u9879\u7684\u503c\uff0c\u53ef\u4ee5\u5728 git config \u547d\u4ee4\u540e\u52a0\u4e0a\u9009\u9879\u548c\u914d\u7f6e\u952e\u3002\u4f8b\u5982\uff0c\u8981\u67e5\u770b\u7528\u6237\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u7528\u6237\u540d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>$ git config user.name<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u65b9\u6cd5 3\uff1a\u4f7f\u7528 git var \u547d\u4ee4<\/strong><\/p>\n<p>git var \u547d\u4ee4\u53ef\u7528\u4e8e\u67e5\u770b Git \u5185\u90e8\u53d8\u91cf\u3002\u8fd9\u4e9b\u53d8\u91cf\u901a\u5e38\u7528\u4e8e\u5b58\u50a8\u8fd0\u884c\u65f6\u4fe1\u606f\uff0c\u4f8b\u5982\u5f53\u524d\u5206\u652f\u3001\u6682\u5b58\u533a\u57df\u72b6\u6001\u7b49\u3002<\/p>\n<pre>$ git var GIT_DIR<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u914d\u7f6e\u4fe1\u606f\u7c7b\u578b<\/strong><\/p>\n<p>Git \u914d\u7f6e\u4fe1\u606f\u5206\u4e3a\u4e09\u7c7b\uff1a<\/p>\n<ul>\n<li> <strong>\u5168\u5c40\u914d\u7f6e\uff1a<\/strong>\u9002\u7528\u4e8e\u6240\u6709\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u5b58\u50a8\u5728 ~\/.gitconfig \u6587\u4ef6\u4e2d\u3002<\/li>\n<li> <strong>\u7528\u6237\u914d\u7f6e\uff1a<\/strong>\u9002\u7528\u4e8e\u5f53\u524d\u7528\u6237\uff0c\u53ef\u5728\u6240\u6709\u672c\u5730\u4ed3\u5e93\u4e2d\u4f7f\u7528\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u5b58\u50a8\u5728 ~\/.gitconfig \u6587\u4ef6\u4e2d\u3002<\/li>\n<li> <strong>\u672c\u5730\u914d\u7f6e\uff1a<\/strong>\u4ec5\u9002\u7528\u4e8e\u5f53\u524d\u4ed3\u5e93\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u5b58\u50a8\u5728\u4ed3\u5e93\u6839\u76ee\u5f55\u7684 .git\/config \u6587\u4ef6\u4e2d\u3002<\/li>\n<\/ul>\n<p><strong>\u8986\u76d6\u987a\u5e8f<\/strong><\/p>\n<p>\u5f53\u540c\u65f6\u5b58\u5728\u591a\u6761\u540c\u540d\u914d\u7f6e\u65f6\uff0c\u8986\u76d6\u987a\u5e8f\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li>\u672c\u5730\u914d\u7f6e<\/li>\n<li>\u7528\u6237\u914d\u7f6e<\/li>\n<li>\u5168\u5c40\u914d\u7f6e<\/li>\n<\/ol>\n<p>\u8fd9\u610f\u5473\u7740\u672c\u5730\u914d\u7f6e\u5c06\u8986\u76d6\u7528\u6237\u914d\u7f6e\uff0c\u7528\u6237\u914d\u7f6e\u5c06\u8986\u76d6\u5168\u5c40\u914d\u7f6e\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u67e5\u770b\u7684\u914d\u7f6e\u4fe1\u606f\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>\u5982\u4f55\u67e5\u770b git \u914d\u7f6e\u4fe1\u606f\u4f7f\u7528 git config \u547d\u4ee4\uff1a\u5217\u51fa\u6240\u6709\u5df2\u914d\u7f6e\u7684\u8bbe\u7f6e\uff08\u65b9\u6cd5 1\uff09\u3002\u67e5\u770b\u7279\u5b9a\u914d\u7f6e\u9879\uff1a\u6307\u5b9a\u9009\u9879\u548c\u914d\u7f6e\u952e\uff08\u65b9\u6cd5 2\uff09\u3002\u4f7f\u7528 git var \u547d\u4ee4\uff1a\u67e5\u770b git \u5185\u90e8\u53d8\u91cf\uff08\u65b9\u6cd5 3\uff09\u3002git \u914d\u7f6e\u4fe1\u606f\u7c7b\u578b\uff1a\u5168\u5c40\u3001\u7528\u6237\u3001\u672c\u5730\uff0c\u6309\u6b64\u987a\u5e8f\u8986\u76d6\u914d\u7f6e\u3002 \u5982\u4f55\u67e5\u770b Git \u914d\u7f6e\u4fe1\u606f \u65b9\u6cd5 1\uff1a\u4f7f\u7528 config \u547d\u4ee4 \u6700\u76f4\u63a5\u67e5\u770b Git \u914d\u7f6e\u4fe1\u606f\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 git config \u547d\u4ee4\u3002\u8be5\u547d\u4ee4\u4f1a\u5217\u51fa\u6240\u6709\u5df2\u914d\u7f6e\u7684\u8bbe\u7f6e\uff0c\u5305\u62ec\u7528\u6237\u7ea7\u548c\u7cfb\u7edf\u7ea7\u8bbe\u7f6e\u3002 $ git config &#8211;list \u767b\u5f55\u540e\u590d\u5236 \u65b9\u6cd5 2\uff1a\u67e5\u770b\u7279\u5b9a\u914d\u7f6e\u9879 \u8981\u67e5\u770b\u7279\u5b9a\u914d\u7f6e\u9879\u7684\u503c\uff0c\u53ef\u4ee5\u5728 git config \u547d\u4ee4\u540e\u52a0\u4e0a\u9009\u9879\u548c\u914d\u7f6e\u952e\u3002\u4f8b\u5982\uff0c\u8981\u67e5\u770b\u7528\u6237\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u7528\u6237\u540d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a $ git config user.name \u767b\u5f55\u540e\u590d\u5236 \u65b9\u6cd5 3\uff1a\u4f7f\u7528 git var \u547d\u4ee4 git var \u547d\u4ee4\u53ef\u7528\u4e8e\u67e5\u770b Git \u5185\u90e8\u53d8\u91cf\u3002\u8fd9\u4e9b\u53d8\u91cf\u901a\u5e38\u7528\u4e8e\u5b58\u50a8\u8fd0\u884c\u65f6\u4fe1\u606f\uff0c\u4f8b\u5982\u5f53\u524d\u5206\u652f\u3001\u6682\u5b58\u533a\u57df\u72b6\u6001\u7b49\u3002 $ [&hellip;]<\/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-21570","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21570","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=21570"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21570\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}