{"id":21527,"date":"2024-11-19T11:29:28","date_gmt":"2024-11-19T03:29:28","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21527\/"},"modified":"2024-11-19T11:29:28","modified_gmt":"2024-11-19T03:29:28","slug":"git%e6%80%8e%e4%b9%88%e5%88%87%e6%8d%a2%e7%94%a8%e6%88%b7","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21527\/","title":{"rendered":"git\u600e\u4e48\u5207\u6362\u7528\u6237"},"content":{"rendered":"<blockquote><p>\n  \u95ee\u9898\uff1a\u5982\u4f55\u5207\u6362 git \u7528\u6237\uff1f\u7b54\u6848\uff1a\u8bbe\u7f6e\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002\u751f\u6210 ssh \u5bc6\u94a5\uff08\u53ef\u9009\uff09\u3002\u6dfb\u52a0 ssh \u5bc6\u94a5\u5230 git\uff08\u53ef\u9009\uff09\u3002\u8bbe\u7f6e github \u51ed\u636e\uff08\u5982\u679c\u4f7f\u7528 github\uff09\u3002\u6d4b\u8bd5\u914d\u7f6e\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053023183652656.jpg\" class=\"aligncenter\" title=\"git\u600e\u4e48\u5207\u6362\u7528\u6237\u63d2\u56fe\" alt=\"git\u600e\u4e48\u5207\u6362\u7528\u6237\u63d2\u56fe\" \/><\/p>\n<p><strong>Git \u5207\u6362\u7528\u6237<\/strong><\/p>\n<p><strong>\u5982\u4f55\u5207\u6362 Git \u7528\u6237\uff1f<\/strong><\/p>\n<p>\u8981\u5207\u6362 Git \u7528\u6237\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u8bbe\u7f6e\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740<\/strong><\/p>\n<pre>git config --global user.name \"[\u4f60\u7684\u7528\u6237\u540d]\"\ngit config --global user.email \"[\u4f60\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740]\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u751f\u6210 SSH \u5bc6\u94a5\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u5e0c\u671b\u901a\u8fc7 SSH \u8fde\u63a5\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5219\u9700\u8981\u751f\u6210 SSH \u5bc6\u94a5\u3002<\/p>\n<pre>ssh-keygen -t rsa -b 4096<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u6dfb\u52a0 SSH \u5bc6\u94a5\u5230 Git\uff08\u53ef\u9009\uff09<\/strong><\/p>\n<pre>ssh-add ~\/.ssh\/id_rsa<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u8bbe\u7f6e GitHub \u51ed\u636e<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u4f7f\u7528 GitHub\uff0c\u8bf7\u8bbe\u7f6e\u4f60\u7684 GitHub \u51ed\u636e\u3002<\/p>\n<pre>git config --global github.user \"[\u4f60\u7684 GitHub \u7528\u6237\u540d]\"\ngit config --global github.token \"[\u4f60\u7684 GitHub \u4ee4\u724c]\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u6d4b\u8bd5\u4f60\u7684\u914d\u7f6e<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6d4b\u8bd5\u4f60\u7684\u914d\u7f6e\u662f\u5426\u6b63\u786e\uff1a<\/p>\n<pre>git config --list<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f60\u4f1a\u770b\u5230\u4f60\u7684\u7528\u6237\u540d\u3001\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u548c SSH \u5bc6\u94a5\uff08\u5982\u679c\u5df2\u751f\u6210\uff09\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5207\u6362\u7528\u6237\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>\u95ee\u9898\uff1a\u5982\u4f55\u5207\u6362 git \u7528\u6237\uff1f\u7b54\u6848\uff1a\u8bbe\u7f6e\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\u3002\u751f\u6210 ssh \u5bc6\u94a5\uff08\u53ef\u9009\uff09\u3002\u6dfb\u52a0 ssh \u5bc6\u94a5\u5230 git\uff08\u53ef\u9009\uff09\u3002\u8bbe\u7f6e github \u51ed\u636e\uff08\u5982\u679c\u4f7f\u7528 github\uff09\u3002\u6d4b\u8bd5\u914d\u7f6e\u3002 Git \u5207\u6362\u7528\u6237 \u5982\u4f55\u5207\u6362 Git \u7528\u6237\uff1f \u8981\u5207\u6362 Git \u7528\u6237\uff0c\u8bf7\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u8bbe\u7f6e\u7528\u6237\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740 git config &#8211;global user.name &#8220;[\u4f60\u7684\u7528\u6237\u540d]&#8221; git config &#8211;global user.email &#8220;[\u4f60\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740]&#8221; \u767b\u5f55\u540e\u590d\u5236 2. \u751f\u6210 SSH \u5bc6\u94a5\uff08\u53ef\u9009\uff09 \u5982\u679c\u4f60\u5e0c\u671b\u901a\u8fc7 SSH \u8fde\u63a5\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u5219\u9700\u8981\u751f\u6210 SSH \u5bc6\u94a5\u3002 ssh-keygen -t rsa -b 4096 \u767b\u5f55\u540e\u590d\u5236 3. \u6dfb\u52a0 SSH \u5bc6\u94a5\u5230 Git\uff08\u53ef\u9009\uff09 ssh-add ~\/.ssh\/id_rsa \u767b\u5f55\u540e\u590d\u5236 [&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-21527","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21527","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=21527"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21527\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}