{"id":19162,"date":"2024-11-19T10:04:01","date_gmt":"2024-11-19T02:04:01","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19162\/"},"modified":"2024-11-19T10:04:01","modified_gmt":"2024-11-19T02:04:01","slug":"%e8%81%8a%e8%81%8agit%e4%b8%8a%e4%b8%ad%e6%96%87%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19162\/","title":{"rendered":"\u804a\u804aGit\u4e0a\u4e2d\u6587\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\u6807\u9898\uff1a<\/p>\n<p>\u4f5c\u4e3a\u4e00\u79cd\u6d41\u884c\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0cGit\u5df2\u7ecf\u6210\u4e3a\u4e86\u5f88\u591a\u5f00\u53d1\u8005\u7684\u9996\u9009\u5de5\u5177\u3002\u7136\u800c\uff0c\u5728\u4f7f\u7528Git\u8fc7\u7a0b\u4e2d\uff0c\u6709\u4e00\u4e9b\u4e2d\u6587\u76f8\u5173\u7684\u95ee\u9898\u4f1a\u8ba9\u4e00\u90e8\u5206\u7528\u6237\u611f\u5230\u56f0\u60d1\u3002\u672c\u6587\u5c06\u4ecb\u7ecdGit\u4e2d\u7684\u4e2d\u6587\u95ee\u9898\uff0c\u5e76\u7ed9\u51fa\u89e3\u51b3\u65b9\u6cd5\u3002<\/p>\n<p>\u4e00\u3001Git\u7684\u9ed8\u8ba4\u7f16\u7801<\/p>\n<p>\u5728Git\u4e2d\uff0c\u9ed8\u8ba4\u4f7f\u7528\u7684\u7f16\u7801\u662fUTF-8\uff0c\u8fd9\u4e5f\u662f\u76ee\u524d\u6700\u4e3a\u5e38\u7528\u7684Unicode\u7f16\u7801\u65b9\u5f0f\u3002UTF-8\u652f\u6301\u6240\u6709\u7684Unicode\u5b57\u7b26\uff0c\u4e0d\u4ec5\u5305\u62ec\u4e2d\u6587\u3001\u82f1\u6587\u3001\u6570\u5b57\u7b49\u5e38\u89c1\u5b57\u7b26\uff0c\u8fd8\u5305\u62ec\u6240\u6709\u7684\u7b26\u53f7\u3001\u8868\u60c5\u7b49\u3002\u56e0\u6b64\uff0c\u4f7f\u7528UTF-8\u7f16\u7801\u7684Git\uff0c\u4e00\u822c\u6765\u8bf4\u662f\u53ef\u4ee5\u5b8c\u7f8e\u5730\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u7684\u3002<\/p>\n<p>\u4e8c\u3001Git\u5ba2\u6237\u7aef\u5728Windows\u4e0a\u7684\u4e2d\u6587\u652f\u6301\u95ee\u9898<\/p>\n<p>\u5c3d\u7ba1Git\u672c\u8eab\u5bf9\u4e2d\u6587\u7684\u652f\u6301\u975e\u5e38\u597d\uff0c\u4f46\u5728Windows\u4e0a\uff0cGit\u5ba2\u6237\u7aef\u4f1a\u9047\u5230\u4e2d\u6587\u6587\u4ef6\u540d\u663e\u793a\u4e71\u7801\u7684\u95ee\u9898\u3002\u8fd9\u662f\u56e0\u4e3a\uff0c\u5728Windows\u4e0b\u9ed8\u8ba4\u4f7f\u7528\u7684\u7f16\u7801\u65b9\u5f0f\u662fANSI\uff0c\u800cANSI\u7f16\u7801\u5e76\u4e0d\u652f\u6301\u4e2d\u6587\u5b57\u7b26\u3002\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u4ee5\u4e0b\u662f\u4e24\u79cd\u5e38\u7528\u7684\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li>\u8bbe\u7f6eGit\u5ba2\u6237\u7aef\u7684\u5b57\u7b26\u7f16\u7801<\/li>\n<\/ol>\n<p>\u5728Git Bash\u4e2d\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<pre>$ git config --global i18n.commitencoding utf-8\n$ git config --global i18n.logoutputencoding utf-8\n$ export LESSCHARSET=utf-8<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4f1a\u5c06Git\u5ba2\u6237\u7aef\u7684\u5b57\u7b26\u7f16\u7801\u8bbe\u7f6e\u4e3aUTF-8\uff0c\u4ece\u800c\u4f7f\u5176\u80fd\u591f\u6b63\u786e\u5730\u663e\u793a\u4e2d\u6587\u6587\u4ef6\u540d\u3002<\/p>\n<ol>\n<li>\u8bbe\u7f6eWindows\u7cfb\u7edf\u7684\u5b57\u7b26\u7f16\u7801<\/li>\n<\/ol>\n<p>\u5982\u679c\u60a8\u4e0d\u60f3\u8bbe\u7f6eGit\u5ba2\u6237\u7aef\u7684\u5b57\u7b26\u7f16\u7801\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eWindows\u7cfb\u7edf\u7684\u5b57\u7b26\u7f16\u7801\u6765\u89e3\u51b3\u4e2d\u6587\u6587\u4ef6\u540d\u4e71\u7801\u7684\u95ee\u9898\u3002\u5177\u4f53\u65b9\u6cd5\u662f\uff1a<\/p>\n<p>1\uff09\u5728\u6587\u4ef6\u8d44\u6e90\u7ba1\u7406\u5668\u4e2d\uff0c\u6253\u5f00\u201c\u6587\u4ef6\u201d\u83dc\u5355 -&gt; \u201c\u66f4\u6539\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u9009\u9879\u201d -&gt; \u201c\u67e5\u770b\u201d\u9009\u9879\u5361\uff0c\u5728\u201c\u9ad8\u7ea7\u8bbe\u7f6e\u201d\u4e2d\uff0c\u627e\u5230\u201c\u4f7f\u7528\u76f8\u540c\u7684\u7a97\u53e3\u6253\u5f00\u6240\u6709\u6587\u4ef6\u201d\u5e76\u53d6\u6d88\u52fe\u9009\u3002<\/p>\n<p>2\uff09\u53f3\u952eGit Bash\u7684\u5feb\u6377\u65b9\u5f0f\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d -&gt; \u201c\u517c\u5bb9\u6027\u201d\u9009\u9879\u5361 -&gt; \u201c\u66f4\u6539\u9ad8DPI\u8bbe\u7f6e\u201d -&gt; \u201c\u8986\u76d6\u9ad8DPI\u7f29\u653e\u884c\u4e3a\u201d\u9009\u9879\u5361 -&gt; \u52fe\u9009\u201c\u5e94\u7528\u7a0b\u5e8f\u201d\u5373\u53ef\u3002<\/p>\n<p>\u4e09\u3001Git\u63d0\u4ea4\u4e2d\u6587\u6587\u4ef6\u540d\u7684\u95ee\u9898<\/p>\n<p>\u6709\u65f6\uff0c\u5728\u4f7f\u7528Git\u63d0\u4ea4\u4e2d\u6587\u6587\u4ef6\u540d\u7684\u65f6\u5019\u4f1a\u9047\u5230\u95ee\u9898\u3002\u8fd9\u662f\u56e0\u4e3a\u5728Git\u7684\u9ed8\u8ba4\u6a21\u5f0f\u4e0b\uff0c\u5b83\u5c06\u4e2d\u6587\u6587\u4ef6\u540d\u8f6c\u6362\u4e3aASCII\u7f16\u7801\uff0c\u8fd9\u6837\u7684\u8bdd\uff0c\u4e2d\u6587\u6587\u4ef6\u540d\u5c31\u53ef\u80fd\u88ab\u622a\u65ad\u6216\u5904\u7406\u4e0d\u6b63\u786e\u3002\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u65b9\u6cd5\u662f\uff1a<\/p>\n<ol>\n<li>\u8bbe\u7f6eGit\u7684\u6587\u4ef6\u540d\u7f16\u7801<\/li>\n<\/ol>\n<p>\u5728Git Bash\u4e2d\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<pre>$ git config --global core.quotepath false\n$ git config --global gui.encoding utf-8\n$ git config --global i18n.commitencoding utf-8<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4f1a\u5c06Git\u7684\u6587\u4ef6\u540d\u7f16\u7801\u8bbe\u7f6e\u4e3aUTF-8\u3002<\/p>\n<ol>\n<li>\u4f7f\u7528Git\u5ba2\u6237\u7aef\u7684Unicode\u6a21\u5f0f<\/li>\n<\/ol>\n<p>Git\u5ba2\u6237\u7aef\u6709\u4e00\u4e2aUnicode\u6a21\u5f0f\uff0c\u53ef\u4ee5\u7528\u6765\u89e3\u51b3\u4e2d\u6587\u6587\u4ef6\u540d\u7684\u95ee\u9898\u3002\u5728Git Bash\u4e2d\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n<pre>$ git config --global core.unicode true<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4f1a\u542f\u7528Git\u5ba2\u6237\u7aef\u7684Unicode\u6a21\u5f0f\uff0c\u4f7f\u5176\u80fd\u591f\u6b63\u786e\u5730\u5904\u7406\u4e2d\u6587\u6587\u4ef6\u540d\u3002<\/p>\n<p>\u7efc\u4e0a\u6240\u8ff0\uff0cGit\u5728\u5904\u7406\u4e2d\u6587\u65b9\u9762\u867d\u7136\u5df2\u7ecf\u975e\u5e38\u6210\u719f\uff0c\u4f46\u4ecd\u7136\u6709\u4e00\u4e9b\u95ee\u9898\u9700\u8981\u6ce8\u610f\u3002\u5982\u679c\u60a8\u9047\u5230\u4e86\u76f8\u5173\u95ee\u9898\uff0c\u4e0d\u59a8\u5c1d\u8bd5\u4ee5\u4e0a\u65b9\u6cd5\u6765\u89e3\u51b3\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u804a\u804aGit\u4e0a\u4e2d\u6587\u95ee\u9898\u7684\u89e3\u51b3\u65b9\u6cd5\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>\u6807\u9898\uff1a \u4f5c\u4e3a\u4e00\u79cd\u6d41\u884c\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0cGit\u5df2\u7ecf\u6210\u4e3a\u4e86\u5f88\u591a\u5f00\u53d1\u8005\u7684\u9996\u9009\u5de5\u5177\u3002\u7136\u800c\uff0c\u5728\u4f7f\u7528Git\u8fc7\u7a0b\u4e2d\uff0c\u6709\u4e00\u4e9b\u4e2d\u6587\u76f8\u5173\u7684\u95ee\u9898\u4f1a\u8ba9\u4e00\u90e8\u5206\u7528\u6237\u611f\u5230\u56f0\u60d1\u3002\u672c\u6587\u5c06\u4ecb\u7ecdGit\u4e2d\u7684\u4e2d\u6587\u95ee\u9898\uff0c\u5e76\u7ed9\u51fa\u89e3\u51b3\u65b9\u6cd5\u3002 \u4e00\u3001Git\u7684\u9ed8\u8ba4\u7f16\u7801 \u5728Git\u4e2d\uff0c\u9ed8\u8ba4\u4f7f\u7528\u7684\u7f16\u7801\u662fUTF-8\uff0c\u8fd9\u4e5f\u662f\u76ee\u524d\u6700\u4e3a\u5e38\u7528\u7684Unicode\u7f16\u7801\u65b9\u5f0f\u3002UTF-8\u652f\u6301\u6240\u6709\u7684Unicode\u5b57\u7b26\uff0c\u4e0d\u4ec5\u5305\u62ec\u4e2d\u6587\u3001\u82f1\u6587\u3001\u6570\u5b57\u7b49\u5e38\u89c1\u5b57\u7b26\uff0c\u8fd8\u5305\u62ec\u6240\u6709\u7684\u7b26\u53f7\u3001\u8868\u60c5\u7b49\u3002\u56e0\u6b64\uff0c\u4f7f\u7528UTF-8\u7f16\u7801\u7684Git\uff0c\u4e00\u822c\u6765\u8bf4\u662f\u53ef\u4ee5\u5b8c\u7f8e\u5730\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u7684\u3002 \u4e8c\u3001Git\u5ba2\u6237\u7aef\u5728Windows\u4e0a\u7684\u4e2d\u6587\u652f\u6301\u95ee\u9898 \u5c3d\u7ba1Git\u672c\u8eab\u5bf9\u4e2d\u6587\u7684\u652f\u6301\u975e\u5e38\u597d\uff0c\u4f46\u5728Windows\u4e0a\uff0cGit\u5ba2\u6237\u7aef\u4f1a\u9047\u5230\u4e2d\u6587\u6587\u4ef6\u540d\u663e\u793a\u4e71\u7801\u7684\u95ee\u9898\u3002\u8fd9\u662f\u56e0\u4e3a\uff0c\u5728Windows\u4e0b\u9ed8\u8ba4\u4f7f\u7528\u7684\u7f16\u7801\u65b9\u5f0f\u662fANSI\uff0c\u800cANSI\u7f16\u7801\u5e76\u4e0d\u652f\u6301\u4e2d\u6587\u5b57\u7b26\u3002\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u4ee5\u4e0b\u662f\u4e24\u79cd\u5e38\u7528\u7684\u65b9\u6cd5\uff1a \u8bbe\u7f6eGit\u5ba2\u6237\u7aef\u7684\u5b57\u7b26\u7f16\u7801 \u5728Git Bash\u4e2d\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\uff1a $ git config &#8211;global i18n.commitencoding utf-8 $ git config &#8211;global i18n.logoutputencoding utf-8 $ export LESSCHARSET=utf-8 \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4f1a\u5c06Git\u5ba2\u6237\u7aef\u7684\u5b57\u7b26\u7f16\u7801\u8bbe\u7f6e\u4e3aUTF-8\uff0c\u4ece\u800c\u4f7f\u5176\u80fd\u591f\u6b63\u786e\u5730\u663e\u793a\u4e2d\u6587\u6587\u4ef6\u540d\u3002 \u8bbe\u7f6eWindows\u7cfb\u7edf\u7684\u5b57\u7b26\u7f16\u7801 \u5982\u679c\u60a8\u4e0d\u60f3\u8bbe\u7f6eGit\u5ba2\u6237\u7aef\u7684\u5b57\u7b26\u7f16\u7801\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eWindows\u7cfb\u7edf\u7684\u5b57\u7b26\u7f16\u7801\u6765\u89e3\u51b3\u4e2d\u6587\u6587\u4ef6\u540d\u4e71\u7801\u7684\u95ee\u9898\u3002\u5177\u4f53\u65b9\u6cd5\u662f\uff1a 1\uff09\u5728\u6587\u4ef6\u8d44\u6e90\u7ba1\u7406\u5668\u4e2d\uff0c\u6253\u5f00\u201c\u6587\u4ef6\u201d\u83dc\u5355 -&gt; \u201c\u66f4\u6539\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u9009\u9879\u201d -&gt; \u201c\u67e5\u770b\u201d\u9009\u9879\u5361\uff0c\u5728\u201c\u9ad8\u7ea7\u8bbe\u7f6e\u201d\u4e2d\uff0c\u627e\u5230\u201c\u4f7f\u7528\u76f8\u540c\u7684\u7a97\u53e3\u6253\u5f00\u6240\u6709\u6587\u4ef6\u201d\u5e76\u53d6\u6d88\u52fe\u9009\u3002 2\uff09\u53f3\u952eGit Bash\u7684\u5feb\u6377\u65b9\u5f0f\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d -&gt; \u201c\u517c\u5bb9\u6027\u201d\u9009\u9879\u5361 -&gt; \u201c\u66f4\u6539\u9ad8DPI\u8bbe\u7f6e\u201d -&gt; \u201c\u8986\u76d6\u9ad8DPI\u7f29\u653e\u884c\u4e3a\u201d\u9009\u9879\u5361 -&gt; \u52fe\u9009\u201c\u5e94\u7528\u7a0b\u5e8f\u201d\u5373\u53ef\u3002 \u4e09\u3001Git\u63d0\u4ea4\u4e2d\u6587\u6587\u4ef6\u540d\u7684\u95ee\u9898 \u6709\u65f6\uff0c\u5728\u4f7f\u7528Git\u63d0\u4ea4\u4e2d\u6587\u6587\u4ef6\u540d\u7684\u65f6\u5019\u4f1a\u9047\u5230\u95ee\u9898\u3002\u8fd9\u662f\u56e0\u4e3a\u5728Git\u7684\u9ed8\u8ba4\u6a21\u5f0f\u4e0b\uff0c\u5b83\u5c06\u4e2d\u6587\u6587\u4ef6\u540d\u8f6c\u6362\u4e3aASCII\u7f16\u7801\uff0c\u8fd9\u6837\u7684\u8bdd\uff0c\u4e2d\u6587\u6587\u4ef6\u540d\u5c31\u53ef\u80fd\u88ab\u622a\u65ad\u6216\u5904\u7406\u4e0d\u6b63\u786e\u3002\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u65b9\u6cd5\u662f\uff1a \u8bbe\u7f6eGit\u7684\u6587\u4ef6\u540d\u7f16\u7801 \u5728Git Bash\u4e2d\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\uff1a $ git config &#8211;global core.quotepath false $ [&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-19162","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19162","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=19162"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19162\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}