{"id":19133,"date":"2024-11-19T14:54:04","date_gmt":"2024-11-19T06:54:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19133\/"},"modified":"2024-11-19T14:54:04","modified_gmt":"2024-11-19T06:54:04","slug":"git-%e4%b8%ad%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae%e4%b8%ad%e6%96%87%e5%ad%97%e7%ac%a6%e9%9b%86","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19133\/","title":{"rendered":"Git \u4e2d\u5982\u4f55\u8bbe\u7f6e\u4e2d\u6587\u5b57\u7b26\u96c6"},"content":{"rendered":"<p>\u5728\u8fdb\u884c\u8f6f\u4ef6\u5f00\u53d1\u65f6\uff0c\u7248\u672c\u7ba1\u7406\u7cfb\u7edf\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002git \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5176\u4e2d\u6700\u91cd\u8981\u7684\u90e8\u5206\u662f\u914d\u7f6e git \u73af\u5883\u3002\u4e0e\u4e00\u822c\u7684\u914d\u7f6e\u4e0d\u540c\uff0cgit \u8fd8\u9700\u8981\u8bbe\u7f6e\u4e2d\u6587\u5b57\u7b26\u96c6\uff0c\u4ee5\u907f\u514d\u4e2d\u6587\u5b57\u7b26\u51fa\u73b0\u4e71\u7801\u7684\u60c5\u51b5\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd git \u4e2d\u5982\u4f55\u8bbe\u7f6e\u4e2d\u6587\u5b57\u7b26\u96c6\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6253\u5f00 Git Bash\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u57fa\u7840\u914d\u7f6e\uff1a<\/p>\n<pre>$ git config --global user.name \"Your Name\"\n$ git config --global user.email \"your_email@example.com\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u7b2c\u4e00\u4e2a\u547d\u4ee4\u662f\u8bbe\u7f6e Git \u7528\u6237\u540d\uff0c\u7b2c\u4e8c\u4e2a\u547d\u4ee4\u662f\u8bbe\u7f6e\u7528\u6237\u90ae\u7bb1\u3002\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u7528 &#8211;local \u53c2\u6570\u66ff\u6362 &#8211;global\uff0c\u8868\u793a\u53ea\u5bf9\u5f53\u524d\u9879\u76ee\u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u8bbe\u7f6e Git \u4f7f\u7528 UTF-8 \u7f16\u7801\uff0c\u56e0\u4e3a UTF-8 \u662f\u5f53\u524d\u6700\u5e38\u7528\u7684\u7f16\u7801\u65b9\u5f0f\uff1a<\/p>\n<pre>$ git config --global i18n.commitencoding utf-8\n$ git config --global i18n.logoutputencoding utf-8<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e24\u4e2a\u547d\u4ee4\u5206\u522b\u8bbe\u7f6e\u63d0\u4ea4\u4fe1\u606f\u7684\u7f16\u7801\u548c\u65e5\u5fd7\u8f93\u51fa\u7684\u7f16\u7801\u65b9\u5f0f\u4e3a UTF-8\u3002<\/p>\n<p>\u7136\u540e\uff0c\u8bbe\u7f6e Git \u4f7f\u7528\u4e2d\u6587\u5b57\u7b26\u96c6\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>$ git config --global core.quotepath false\n$ git config --global gui.encoding utf-8\n$ git config --global utf8.auto false<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d\uff0ccore.quotepath \u547d\u4ee4\u8868\u793a\u5bf9\u8def\u5f84\u4e2d\u7684\u4e2d\u6587\u8fdb\u884c\u8f6c\u4e49\uff0cgui.encoding \u547d\u4ee4\u8868\u793a Git Gui \u4f7f\u7528\u7684\u7f16\u7801\u65b9\u5f0f\u4e3a UTF-8\uff0cutf8.auto \u547d\u4ee4\u8868\u793a\u7981\u7528\u8def\u5f84\u540d\u4e2d\u7684\u4e2d\u6587\uff0c\u8fdb\u884c\u539f\u5c01\u4e0d\u52a8\u7684\u5c55\u793a\u3002<\/p>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u91cd\u542f Git\uff0c\u4f7f\u5f97\u65b0\u7684\u914d\u7f6e\u751f\u6548\uff1a<\/p>\n<pre>$ git config --system --unset credential.helper<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8f93\u5165\u8be5\u547d\u4ee4\u540e\uff0c\u5728 Git Bash \u4e2d\u5173\u95ed Git \u518d\u91cd\u65b0\u6253\u5f00\uff0c\u76f8\u5e94\u7684 Git \u4e2d\u6587\u5b57\u7b26\u96c6\u914d\u7f6e\u5c31\u5df2\u7ecf\u5b8c\u6210\u3002<\/p>\n<p>\u603b\u7ed3\u4e00\u4e0b\uff0cGit \u4e2d\u6587\u5b57\u7b26\u96c6\u914d\u7f6e\u4e3b\u8981\u5305\u62ec\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/p>\n<ol>\n<li>\u57fa\u7840\u914d\u7f6e\uff1a\u8bbe\u7f6e Git \u7528\u6237\u540d\u548c\u7528\u6237\u90ae\u7bb1<\/li>\n<li>\u7f16\u7801\u914d\u7f6e\uff1a\u8bbe\u7f6e Git \u4f7f\u7528 UTF-8 \u7f16\u7801\u65b9\u5f0f<\/li>\n<li>\u4e2d\u6587\u5b57\u7b26\u96c6\u914d\u7f6e\uff1a\u5206\u522b\u8bbe\u7f6e core.quotepath\u3001gui.encoding \u548c utf8.auto \u547d\u4ee4<\/li>\n<\/ol>\n<p>\u5b8c\u6210\u4e0a\u8ff0\u914d\u7f6e\u540e\uff0cGit \u4e2d\u6587\u5b57\u7b26\u96c6\u5c31\u53ef\u4ee5\u6b63\u5e38\u5c55\u793a\u3002Git \u4e0d\u4f46\u662f\u4e00\u4e2a\u9ad8\u6548\u7684\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u4e5f\u662f\u5f00\u6e90\u4ee3\u7801\u7ba1\u7406\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\uff0c\u5408\u7406\u7684 Git \u4e2d\u6587\u914d\u7f6e\u80fd\u591f\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u51cf\u5c11\u56e0\u5b57\u7b26\u96c6\u51fa\u73b0\u7684\u5404\u79cd\u95ee\u9898\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fGit \u4e2d\u5982\u4f55\u8bbe\u7f6e\u4e2d\u6587\u5b57\u7b26\u96c6\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>\u5728\u8fdb\u884c\u8f6f\u4ef6\u5f00\u53d1\u65f6\uff0c\u7248\u672c\u7ba1\u7406\u7cfb\u7edf\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u3002git \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5176\u4e2d\u6700\u91cd\u8981\u7684\u90e8\u5206\u662f\u914d\u7f6e git \u73af\u5883\u3002\u4e0e\u4e00\u822c\u7684\u914d\u7f6e\u4e0d\u540c\uff0cgit \u8fd8\u9700\u8981\u8bbe\u7f6e\u4e2d\u6587\u5b57\u7b26\u96c6\uff0c\u4ee5\u907f\u514d\u4e2d\u6587\u5b57\u7b26\u51fa\u73b0\u4e71\u7801\u7684\u60c5\u51b5\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd git \u4e2d\u5982\u4f55\u8bbe\u7f6e\u4e2d\u6587\u5b57\u7b26\u96c6\u3002 \u9996\u5148\uff0c\u6253\u5f00 Git Bash\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u57fa\u7840\u914d\u7f6e\uff1a $ git config &#8211;global user.name &#8220;Your Name&#8221; $ git config &#8211;global user.email &#8220;your_email@example.com&#8221; \u767b\u5f55\u540e\u590d\u5236 \u7b2c\u4e00\u4e2a\u547d\u4ee4\u662f\u8bbe\u7f6e Git \u7528\u6237\u540d\uff0c\u7b2c\u4e8c\u4e2a\u547d\u4ee4\u662f\u8bbe\u7f6e\u7528\u6237\u90ae\u7bb1\u3002\u8fd9\u91cc\u4e5f\u53ef\u4ee5\u7528 &#8211;local \u53c2\u6570\u66ff\u6362 &#8211;global\uff0c\u8868\u793a\u53ea\u5bf9\u5f53\u524d\u9879\u76ee\u8fdb\u884c\u914d\u7f6e\u3002 \u63a5\u4e0b\u6765\uff0c\u8bbe\u7f6e Git \u4f7f\u7528 UTF-8 \u7f16\u7801\uff0c\u56e0\u4e3a UTF-8 \u662f\u5f53\u524d\u6700\u5e38\u7528\u7684\u7f16\u7801\u65b9\u5f0f\uff1a $ git config &#8211;global i18n.commitencoding utf-8 $ git config &#8211;global i18n.logoutputencoding utf-8 \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e24\u4e2a\u547d\u4ee4\u5206\u522b\u8bbe\u7f6e\u63d0\u4ea4\u4fe1\u606f\u7684\u7f16\u7801\u548c\u65e5\u5fd7\u8f93\u51fa\u7684\u7f16\u7801\u65b9\u5f0f\u4e3a UTF-8\u3002 \u7136\u540e\uff0c\u8bbe\u7f6e Git \u4f7f\u7528\u4e2d\u6587\u5b57\u7b26\u96c6\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a [&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-19133","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19133","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=19133"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19133\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}