{"id":20174,"date":"2024-11-19T09:18:17","date_gmt":"2024-11-19T01:18:17","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20174\/"},"modified":"2024-11-19T09:18:17","modified_gmt":"2024-11-19T01:18:17","slug":"git%e6%9c%ac%e5%9c%b0%e8%ae%be%e7%bd%ae%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20174\/","title":{"rendered":"git\u672c\u5730\u8bbe\u7f6e\u5bc6\u7801"},"content":{"rendered":"<p>\u4f5c\u4e3a\u5f00\u53d1\u8005\uff0c\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u4f7f\u7528git\u8fdb\u884c\u7248\u672c\u63a7\u5236\u3002\u901a\u5e38\u6211\u4eec\u4f1a\u5c06\u4ee3\u7801push\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u8fd9\u65f6\u6211\u4eec\u9700\u8981\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\u8fdb\u884c\u9a8c\u8bc1\u3002\u4f46\u662f\uff0c\u6bcf\u6b21\u90fd\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\u975e\u5e38\u9ebb\u70e6\uff0c\u6709\u6ca1\u6709\u4ec0\u4e48\u65b9\u6cd5\u53ef\u4ee5\u7b80\u5316\u8fd9\u4e2a\u8fc7\u7a0b\u5462\uff1f\u672c\u6587\u5c31\u6765\u4ecb\u7ecd\u5982\u4f55\u5728\u672c\u5730\u8bbe\u7f6egit\u5bc6\u7801\uff0c\u8ba9\u4f60\u7684git\u4f7f\u7528\u66f4\u52a0\u4fbf\u6377\u3002<\/p>\n<ol>\n<li>\u5b89\u88c5Git<\/li>\n<\/ol>\n<p>\u9996\u5148\u9700\u8981\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86git\uff0c\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u53bb\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5\u5305\u5b89\u88c5\uff1ahttps:\/\/git-scm.com\/download<\/p>\n<ol>\n<li>\u6253\u5f00Git Bash<\/li>\n<\/ol>\n<p>\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u547d\u4ee4\uff1aGit Bash<\/p>\n<ol>\n<li>\u8bbe\u7f6e\u5168\u5c40\u7528\u6237\u540d\u548c\u90ae\u7bb1<\/li>\n<\/ol>\n<p>\u5728\u7ec8\u7aef\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\u5168\u5c40\u7684\u7528\u6237\u540d\u548c\u90ae\u7bb1\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<ol>\n<li>\u751f\u6210SSH\u5bc6\u94a5<\/li>\n<\/ol>\n<p>\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u751f\u6210\u8fc7SSH\u5bc6\u94a5\uff0c\u53ef\u4ee5\u8df3\u8fc7\u8fd9\u4e00\u6b65\u3002\u5426\u5219\uff0c\u5728\u7ec8\u7aef\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u751f\u6210SSH\u5bc6\u94a5\uff1a<\/p>\n<pre>$ ssh-keygen -t rsa -C \"your.email@example.com\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6309\u7167\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u6216\u8005\u76f4\u63a5\u6309\u56de\u8f66\u952e\u8df3\u8fc7\u5bc6\u7801\u8bbe\u7f6e\u3002<\/p>\n<ol>\n<li>\u8bbe\u7f6e\u5bc6\u7801\u7f13\u5b58<\/li>\n<\/ol>\n<p>\u5728git\u4e2d\uff0c\u6709\u4e24\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5728\u672c\u5730\u7f13\u5b58\u5bc6\u7801\uff1a\u4f7f\u7528git\u7684credential helper\uff0c\u6216\u4f7f\u7528SSH\u4ee3\u7406\u3002\u8fd9\u91cc\u6211\u4eec\u5c06\u4ecb\u7ecd\u7b2c\u4e00\u79cd\u65b9\u5f0f\u3002<\/p>\n<p>\u5728\u7ec8\u7aef\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>$ git config --global credential.helper cache<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u5c06\u5f00\u542f\u5bc6\u7801\u7f13\u5b58\uff0c\u5e76\u8bbe\u7f6e\u9ed8\u8ba4\u7f13\u5b58\u65f6\u95f4\u4e3a15\u5206\u949f\u3002\u5982\u679c\u9700\u8981\u81ea\u5b9a\u4e49\u65f6\u95f4\uff0c\u53ef\u4ee5\u5728\u540e\u9762\u52a0\u4e0a\u53c2\u6570\uff0c\u5355\u4f4d\u4e3a\u79d2\uff0c\u6bd4\u5982\u8bbe\u7f6e\u4e3a30\u5206\u949f\u5219\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>$ git config --global credential.helper 'cache --timeout=1800'<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u8f93\u5165\u5bc6\u7801\u9a8c\u8bc1<\/li>\n<\/ol>\n<p>\u5b8c\u6210\u4ee5\u4e0a\u8bbe\u7f6e\u540e\uff0c\u4f60\u518d\u6b21\u8fdb\u884cgit\u64cd\u4f5c\u65f6\uff0c\u4f1a\u770b\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u63d0\u793a\uff1a<\/p>\n<pre>$ git push\nUsername for 'https:\/\/github.com': your_username\nPassword for 'https:\/\/your_username@github.com':<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u65f6\u4f60\u53ea\u9700\u8981\u8f93\u5165\u4e00\u6b21\u5bc6\u7801\uff0c\u4e4b\u540egit\u4f1a\u628a\u5bc6\u7801\u7f13\u5b58\u8d77\u6765\uff0c\u4f60\u518d\u6b21\u6267\u884c\u7c7b\u4f3c\u7684\u547d\u4ee4\u65f6\u5c31\u4e0d\u9700\u8981\u518d\u8f93\u5165\u5bc6\u7801\u4e86\u3002<\/p>\n<ol>\n<li>\u6e05\u9664\u7f13\u5b58<\/li>\n<\/ol>\n<p>\u5982\u679c\u4f60\u60f3\u6e05\u9664\u5bc6\u7801\u7f13\u5b58\uff0c\u53ef\u4ee5\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>$ git config --global --unset credential.helper<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u5c06\u7981\u7528\u5bc6\u7801\u7f13\u5b58\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u4f60\u5b66\u4f1a\u4e86\u5982\u4f55\u5728\u672c\u5730\u8bbe\u7f6egit\u5bc6\u7801\uff0c\u8ba9\u4f60\u7684git\u4f7f\u7528\u66f4\u52a0\u4fbf\u6377\u3002\u5f53\u7136\uff0c\u4e3a\u4e86\u4fdd\u8bc1\u8d26\u6237\u5b89\u5168\uff0c\u6211\u4eec\u4e0d\u5efa\u8bae\u5c06\u5bc6\u7801\u6c38\u4e45\u4fdd\u5b58\u5728\u672c\u5730\u3002\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u516c\u7528\u7535\u8111\uff0c\u90a3\u4e48\u4e00\u5b9a\u8981\u8c28\u614e\u64cd\u4f5c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fgit\u672c\u5730\u8bbe\u7f6e\u5bc6\u7801\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>\u4f5c\u4e3a\u5f00\u53d1\u8005\uff0c\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u4f7f\u7528git\u8fdb\u884c\u7248\u672c\u63a7\u5236\u3002\u901a\u5e38\u6211\u4eec\u4f1a\u5c06\u4ee3\u7801push\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u8fd9\u65f6\u6211\u4eec\u9700\u8981\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\u8fdb\u884c\u9a8c\u8bc1\u3002\u4f46\u662f\uff0c\u6bcf\u6b21\u90fd\u8f93\u5165\u7528\u6237\u540d\u548c\u5bc6\u7801\u975e\u5e38\u9ebb\u70e6\uff0c\u6709\u6ca1\u6709\u4ec0\u4e48\u65b9\u6cd5\u53ef\u4ee5\u7b80\u5316\u8fd9\u4e2a\u8fc7\u7a0b\u5462\uff1f\u672c\u6587\u5c31\u6765\u4ecb\u7ecd\u5982\u4f55\u5728\u672c\u5730\u8bbe\u7f6egit\u5bc6\u7801\uff0c\u8ba9\u4f60\u7684git\u4f7f\u7528\u66f4\u52a0\u4fbf\u6377\u3002 \u5b89\u88c5Git \u9996\u5148\u9700\u8981\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86git\uff0c\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u53bb\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5\u5305\u5b89\u88c5\uff1ahttps:\/\/git-scm.com\/download \u6253\u5f00Git Bash \u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u547d\u4ee4\uff1aGit Bash \u8bbe\u7f6e\u5168\u5c40\u7528\u6237\u540d\u548c\u90ae\u7bb1 \u5728\u7ec8\u7aef\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\u5168\u5c40\u7684\u7528\u6237\u540d\u548c\u90ae\u7bb1\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 \u751f\u6210SSH\u5bc6\u94a5 \u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u751f\u6210\u8fc7SSH\u5bc6\u94a5\uff0c\u53ef\u4ee5\u8df3\u8fc7\u8fd9\u4e00\u6b65\u3002\u5426\u5219\uff0c\u5728\u7ec8\u7aef\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u751f\u6210SSH\u5bc6\u94a5\uff1a $ ssh-keygen -t rsa -C &#8220;your.email@example.com&#8221; \u767b\u5f55\u540e\u590d\u5236 \u6309\u7167\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u6216\u8005\u76f4\u63a5\u6309\u56de\u8f66\u952e\u8df3\u8fc7\u5bc6\u7801\u8bbe\u7f6e\u3002 \u8bbe\u7f6e\u5bc6\u7801\u7f13\u5b58 \u5728git\u4e2d\uff0c\u6709\u4e24\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5728\u672c\u5730\u7f13\u5b58\u5bc6\u7801\uff1a\u4f7f\u7528git\u7684credential helper\uff0c\u6216\u4f7f\u7528SSH\u4ee3\u7406\u3002\u8fd9\u91cc\u6211\u4eec\u5c06\u4ecb\u7ecd\u7b2c\u4e00\u79cd\u65b9\u5f0f\u3002 \u5728\u7ec8\u7aef\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a $ git config &#8211;global credential.helper cache \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u5c06\u5f00\u542f\u5bc6\u7801\u7f13\u5b58\uff0c\u5e76\u8bbe\u7f6e\u9ed8\u8ba4\u7f13\u5b58\u65f6\u95f4\u4e3a15\u5206\u949f\u3002\u5982\u679c\u9700\u8981\u81ea\u5b9a\u4e49\u65f6\u95f4\uff0c\u53ef\u4ee5\u5728\u540e\u9762\u52a0\u4e0a\u53c2\u6570\uff0c\u5355\u4f4d\u4e3a\u79d2\uff0c\u6bd4\u5982\u8bbe\u7f6e\u4e3a30\u5206\u949f\u5219\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a $ git config &#8211;global credential.helper &#8216;cache &#8211;timeout=1800&#8217; \u767b\u5f55\u540e\u590d\u5236 \u8f93\u5165\u5bc6\u7801\u9a8c\u8bc1 \u5b8c\u6210\u4ee5\u4e0a\u8bbe\u7f6e\u540e\uff0c\u4f60\u518d\u6b21\u8fdb\u884cgit\u64cd\u4f5c\u65f6\uff0c\u4f1a\u770b\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u63d0\u793a\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-20174","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20174","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=20174"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20174\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}