{"id":559,"date":"2024-08-14T15:02:30","date_gmt":"2024-08-14T07:02:30","guid":{"rendered":"https:\/\/thereisno.top:4430\/?p=559"},"modified":"2024-08-14T15:02:30","modified_gmt":"2024-08-14T07:02:30","slug":"git%e8%ae%be%e7%bd%aeconfig","status":"publish","type":"post","link":"https:\/\/thereisno.top\/?p=559","title":{"rendered":"git\u8bbe\u7f6econfig"},"content":{"rendered":"\n<p># \u5220\u9664\u4e00\u6761\u914d\u7f6e\u4fe1\u606f<br>git config &#8211;unset user.name<\/p>\n\n\n\n<p># \u5220\u9664\u6240\u6709\u914d\u7f6e\u4fe1\u606f<br>git config &#8211;unset-all<\/p>\n\n\n\n<p>\u4e8c.\u4f60\u7684\u6807\u8bc6(Your Identity)<\/p>\n\n\n\n<p>2.1\u3000\u5f53\u4f60\u5b89\u88c5Git\u540e\u9996\u5148\u8981\u505a\u7684\u4e8b\u60c5\u662f\u8bbe\u7f6e\u4f60\u7684\u7528\u6237\u540d\u79f0\u548ce-mail\u5730\u5740\u3002\u8fd9\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u56e0\u4e3a\u6bcf\u6b21Git\u63d0\u4ea4\u90fd\u4f1a\u4f7f\u7528\u8be5\u4fe1\u606f\u3002\u5b83\u88ab\u6c38\u8fdc\u7684\u5d4c\u5165\u5230\u4e86\u4f60\u7684\u63d0\u4ea4\u4e2d\uff1a<\/p>\n\n\n\n<p>\u3000\u3000$ git config &#8211;global user.name &#8220;John Doe&#8221;<\/p>\n\n\n\n<p>\u3000&nbsp; $ git config &#8211;global user.email johndoe@example.com<\/p>\n\n\n\n<p>&nbsp;\u3000 \u91cd\u7533\u4e00\u904d\uff0c\u4f60\u53ea\u9700\u8981\u505a\u4e00\u6b21\u8fd9\u4e2a\u8bbe\u7f6e\u3002\u5982\u679c\u4f60\u4f20\u9012\u4e86 &#8211;global \u9009\u9879\uff0c\u56e0\u4e3aGit\u5c06\u603b\u662f\u4f1a\u4f7f\u7528\u8be5\u4fe1\u606f\u6765\u5904\u7406\u4f60\u5728\u7cfb\u7edf\u4e2d\u6240\u505a\u7684\u4e00\u5207\u64cd\u4f5c\u3002\u5982\u679c\u4f60\u5e0c\u671b\u5728\u4e00\u4e2a\u7279\u5b9a\u7684\u9879\u76ee\u4e2d\u4f7f\u7528\u4e0d\u540c\u7684\u540d\u79f0\u6216e-mail\u5730\u5740\uff0c\u4f60\u53ef\u4ee5\u5728\u8be5\u9879\u76ee\u4e2d\u8fd0\u884c\u8be5\u547d\u4ee4\u800c\u4e0d\u8981&#8211;global\u9009\u9879\u3002<\/p>\n\n\n\n<p>2.2 \u4f60\u7684\u7f16\u8f91\u5668(Your Editor)<\/p>\n\n\n\n<p>\u3000\u3000\u73b0\u5728\uff0c\u4f60\u7684\u6807\u8bc6\u5df2\u7ecf\u8bbe\u7f6e\uff0c\u4f60\u53ef\u4ee5\u914d\u7f6e\u4f60\u7684\u7f3a\u7701\u6587\u672c\u7f16\u8f91\u5668\uff0cGit\u5728\u9700\u8981\u4f60\u8f93\u5165\u4e00\u4e9b\u6d88\u606f\u65f6\u4f1a\u4f7f\u7528\u8be5\u6587\u672c\u7f16\u8f91\u5668\u3002\u7f3a\u7701\u60c5\u51b5\u4e0b\uff0cGit\u4f7f\u7528\u4f60\u7684\u7cfb\u7edf\u7684\u7f3a\u7701\u7f16\u8f91\u5668\uff0c\u8fd9\u901a\u5e38\u53ef\u80fd\u662fvi \u6216\u8005 vim\u3002\u5982\u679c\u4f60\u60f3\u4f7f\u7528\u4e00\u4e2a\u4e0d\u540c\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u4f8b\u5982Emacs\uff0c\u4f60\u53ef\u4ee5\u505a\u5982\u4e0b\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<p>\u3000\u3000$ git config &#8211;global core.editor emacs<\/p>\n\n\n\n<p>2.3 \u4f60\u7684\u6bd4\u8f83\u5de5\u5177(Your Diff Tool)<\/p>\n\n\n\n<p>\u3000\u3000\u53e6\u5916\u4e00\u4e2a\u4f60\u53ef\u80fd\u9700\u8981\u914d\u7f6e\u7684\u6709\u7528\u7684\u9009\u9879\u662f\u7f3a\u7701\u7684\u6bd4\u8f83\u5de5\u5177\u5b83\u7528\u6765\u89e3\u51b3\u5408\u5e76\u65f6\u7684\u51b2\u7a81\u3002\u4f8b\u5982\uff0c\u4f60\u60f3\u4f7f\u7528vimdiff:<\/p>\n\n\n\n<p>\u3000\u3000$ git config &#8211;global merge.tool vimdiff<\/p>\n\n\n\n<p>&nbsp;\u3000\u3000Git\u53ef\u4ee5\u63a5\u53d7kdiff3,tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, \u548c opendiff\u4f5c\u4e3a\u6709\u6548\u7684\u5408\u5e76\u5de5\u5177\u3002\u4f60\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u4e00\u4e2a\u5ba2\u6237\u5316\u7684\u5de5\u5177\uff1b\u67e5\u770b\u7b2c7\u7ae0\u83b7\u5f97\u66f4\u591a\u5173\u4e8e\u6b64\u7684\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>2.4 \u68c0\u67e5\u4f60\u7684\u8bbe\u7f6e(Checking Your Settings)<\/p>\n\n\n\n<p>\u3000\u3000\u5982\u679c\u4f60\u60f3\u68c0\u67e5\u4f60\u7684\u8bbe\u7f6e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 git config &#8211;list \u547d\u4ee4\u6765\u5217\u51faGit\u53ef\u4ee5\u5728\u8be5\u5904\u627e\u5230\u7684\u6240\u6709\u7684\u8bbe\u7f6e:<\/p>\n\n\n\n<p>\u3000\u3000$ git config &#8211;list<\/p>\n\n\n\n<p>\u3000\u3000user.name=Scott Chacon<\/p>\n\n\n\n<p>\u3000\u3000user.email=schacon@gmail.com<\/p>\n\n\n\n<p>\u3000\u3000color.status=auto<\/p>\n\n\n\n<p>\u3000\u3000color.branch=auto<\/p>\n\n\n\n<p>\u3000\u3000color.interactive=auto<\/p>\n\n\n\n<p>\u3000\u3000color.diff=auto<\/p>\n\n\n\n<p>\u3000\u3000&#8230;<\/p>\n\n\n\n<p>\u3000\u3000\u4f60\u53ef\u80fd\u4f1a\u770b\u5230\u4e00\u4e2a\u5173\u952e\u5b57\u51fa\u73b0\u591a\u6b21\uff0c\u8fd9\u662f\u56e0\u4e3aGit\u4ece\u4e0d\u540c\u7684\u6587\u4ef6\u4e2d(\u4f8b\u5982\uff1a\/etc\/gitconfig\u4ee5\u53ca~\/.gitconfig)\u8bfb\u53d6\u76f8\u540c\u7684\u5173\u952e\u5b57\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5bf9\u6bcf\u4e2a\u552f\u4e00\u7684\u5173\u952e\u5b57\uff0cGit\u4f7f\u7528\u6700\u540e\u7684\u90a3\u4e2a\u503c\u3002<\/p>\n\n\n\n<p>\u3000\u3000\u4f60\u4e5f\u53ef\u4ee5\u67e5\u770bGit\u8ba4\u4e3a\u7684\u4e00\u4e2a\u7279\u5b9a\u7684\u5173\u952e\u5b57\u76ee\u524d\u7684\u503c\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4 gitconfig {key}:<\/p>\n\n\n\n<p>\u3000\u3000$ git config user.name<\/p>\n\n\n\n<p>\u3000\u3000Scott Chacon<\/p>\n\n\n\n<p>2.5 \u83b7\u53d6\u5e2e\u52a9(Getting help)<\/p>\n\n\n\n<p>\u3000\u3000\u5982\u679c\u5f53\u4f60\u5728\u4f7f\u7528Git\u65f6\u9700\u8981\u5e2e\u52a9\uff0c\u6709\u4e09\u79cd\u65b9\u6cd5\u53ef\u4ee5\u83b7\u5f97\u4efb\u4f55git\u547d\u4ee4\u7684\u624b\u518c\u9875(manpage)\u5e2e\u52a9\u4fe1\u606f:<\/p>\n\n\n\n<p>\u3000\u3000$ git help &lt;verb&gt;<\/p>\n\n\n\n<p>\u3000\u3000$ git &lt;verb&gt; &#8211;help<\/p>\n\n\n\n<p>\u3000\u3000$ man git-&lt;verb&gt;<\/p>\n\n\n\n<p>&nbsp;\u3000\u3000\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\u83b7\u53d6\u5bf9config\u547d\u4ee4\u7684\u624b\u518c\u9875\u5e2e\u52a9:<\/p>\n\n\n\n<p>\u3000\u3000$ git help config<\/p>\n\n\n\n<p>&nbsp;\u3000\u3000\u8fd9\u4e9b\u547d\u4ee4\u975e\u5e38\u53cb\u597d\uff0c\u56e0\u4e3a\u4f60\u53ef\u4ee5\u5728\u4efb\u4f55\u5730\u65b9\u5b58\u53d6\u4ed6\u4eec\uff0c\u5373\u4f7f\u975e\u5728\u7ebf\u72b6\u6001\u3002\u5982\u679c\u624b\u518c\u9875\u548c\u672c\u4e66\u4ecd\u7136\u4e0d\u8db3\u800c\u4f60\u9700\u8981\u4e2a\u4eba\u7684\u5e2e\u52a9\uff0c\u4f60\u53ef\u4ee5\u8bd5\u7740\u4f7f\u7528FreenodeIRCServer\u4e0a\u7684#git\u6216#github \u9891\u9053(irc.freenode.net)\u3002\u8fd9\u4e9b\u9891\u9053\u4f1a\u5b9a\u671f\u7531\u6570\u767e\u4e2a\u5bf9Git\u975e\u5e38\u719f\u6089\u7684\u4e13\u4e1a\u4eba\u58eb\u6240\u7ef4\u62a4\uff0c\u4ed6\u4eec\u4f1a\u975e\u5e38\u4e50\u610f\u5e2e\u52a9\u4f60\u3002<\/p>\n\n\n\n<p>2.6 \u603b\u7ed3(Summary)<\/p>\n\n\n\n<p>\u3000\u3000\u4f60\u5e94\u8be5\u5bf9Git\u662f\u4ec0\u4e48\u4ee5\u53caGit\u4e0e\u4f60\u53ef\u80fd\u4f7f\u7528\u7684\u5176\u5b83CVCS\u4e4b\u95f4\u7684\u4e0d\u540c\u6709\u4e86\u4e00\u4e2a\u57fa\u672c\u7684\u4e86\u89e3\u3002\u4f60\u4e5f\u5e94\u5f53\u5728\u4f60\u7684\u7cfb\u7edf\u4e2d\u6709\u4e86\u4e00\u4e2a\u5177\u6709\u4f60\u4e2a\u4eba\u6807\u8bc6\u7684\u53ef\u4ee5\u5de5\u4f5c\u7684Git\u7248\u672c\u3002\u662f\u65f6\u5019\u6765\u5b66\u4e60\u4e00\u4e9bGit\u7684\u57fa\u672c\u77e5\u8bc6\u4e86\u3002<\/p>\n\n\n\n<p><mark style=\"background-color:#fcb900\" class=\"has-inline-color\">\u6362\u884c\u7b26\u8f6c\u6362<\/mark><\/p>\n\n\n\n<p>git config &#8211;global core.autocrlf false<\/p>\n\n\n\n<p><mark style=\"background-color:#fcb900\" class=\"has-inline-color\">#\u63d0\u4ea4\u65f6\u8f6c\u6362\u4e3aLF\uff0c\u68c0\u51fa\u65f6\u8f6c\u6362\u4e3aCRLF<\/mark><\/p>\n\n\n\n<p>git config &#8211;global core.autocrlf true<\/p>\n\n\n\n<p>#\u63d0\u4ea4\u65f6\u8f6c\u6362\u4e3aLF\uff0c\u68c0\u51fa\u65f6\u4e0d\u8f6c\u6362<\/p>\n\n\n\n<p>git config &#8211;global core.autocrlf input<\/p>\n\n\n\n<p>SafeCRLF<\/p>\n\n\n\n<p>#\u62d2\u7edd\u63d0\u4ea4\u5305\u542b\u6df7\u5408\u6362\u884c\u7b26\u7684\u6587\u4ef6<\/p>\n\n\n\n<p>git config &#8211;global core.safecrlf true<\/p>\n\n\n\n<p>#\u5141\u8bb8\u63d0\u4ea4\u5305\u542b\u6df7\u5408\u6362\u884c\u7b26\u7684\u6587\u4ef6<\/p>\n\n\n\n<p>git config &#8211;global core.safecrlf false<\/p>\n\n\n\n<p>#\u63d0\u4ea4\u5305\u542b\u6df7\u5408\u6362\u884c\u7b26\u7684\u6587\u4ef6\u65f6\u7ed9\u51fa\u8b66\u544a<\/p>\n\n\n\n<p>git config &#8211;global core.safecrlf warn<\/p>\n","protected":false},"excerpt":{"rendered":"<p># \u5220\u9664\u4e00\u6761\u914d\u7f6e\u4fe1\u606fgit config &#8211;unset user.name # \u5220\u9664\u6240\u6709\u914d\u7f6e\u4fe1\u606fg &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/thereisno.top\/?p=559\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cgit\u8bbe\u7f6econfig\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[2],"class_list":["post-559","post","type-post","status-publish","format-standard","hentry","category-git","tag-git"],"_links":{"self":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=559"}],"version-history":[{"count":1,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/559\/revisions"}],"predecessor-version":[{"id":560,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/559\/revisions\/560"}],"wp:attachment":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}