{"id":19811,"date":"2024-11-19T08:45:22","date_gmt":"2024-11-19T00:45:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19811\/"},"modified":"2024-11-19T08:45:22","modified_gmt":"2024-11-19T00:45:22","slug":"gitee%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%ae%e6%9c%ac%e5%9c%b0%e8%b4%a6%e5%8f%b7%e5%92%8c%e5%af%86%e7%a0%81%ef%bc%88%e6%ad%a5%e9%aa%a4%ef%bc%89","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19811\/","title":{"rendered":"gitee\u5982\u4f55\u914d\u7f6e\u672c\u5730\u8d26\u53f7\u548c\u5bc6\u7801\uff08\u6b65\u9aa4\uff09"},"content":{"rendered":"<p>\u5728\u4f7f\u7528gitee\u8fdb\u884c\u4ee3\u7801\u6258\u7ba1\u548c\u56e2\u961f\u534f\u4f5c\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u914d\u7f6e\u672c\u5730\u8d26\u53f7\u548c\u5bc6\u7801\uff0c\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u5728Gitee\u5b98\u7f51\u6ce8\u518c\u5e76\u767b\u9646\u8d26\u53f7\uff1b<\/li>\n<li>\u5728\u8d26\u53f7\u8bbe\u7f6e\u4e2d\u627e\u5230\u201cAccess Token\u201d\u9009\u9879\u5361\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Access Token\uff0c\u5e76\u5c06Token\u503c\u4fdd\u5b58\u5728\u672c\u5730\uff0c\u5f85\u4f1a\u513f\u4f1a\u7528\u5230\uff1b<\/li>\n<li>\u4e0b\u8f7d\u5e76\u5b89\u88c5Git\u5ba2\u6237\u7aef\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\u5728\u547d\u4ee4\u884c\u7a97\u53e3\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u884c\uff1a<\/li>\n<\/ol>\n<pre>git config --global user.name \"\u4f60\u7684Gitee\u7528\u6237\u540d\"\ngit config --global user.email \"\u4f60\u7684Gitee\u6ce8\u518c\u90ae\u7bb1\"\ngit config --global credential.helper store<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5176\u4e2d\u7b2c\u4e09\u884c\u547d\u4ee4\u662f\u5c06\u672c\u5730\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u4fdd\u5b58\uff0c\u907f\u514d\u6bcf\u6b21\u90fd\u9700\u8981\u8f93\u5165\u3002\u5982\u679c\u4e0d\u52a0\u8fd9\u6761\u547d\u4ee4\uff0c\u5728\u6bcf\u6b21 push \u548c pull \u64cd\u4f5c\u7684\u65f6\u5019\u90fd\u9700\u8981\u8f93\u5165\u8d26\u53f7\u548c\u5bc6\u7801\u3002<\/p>\n<ol>\n<li>\u63a5\u4e0b\u6765\u9700\u8981\u8bbe\u7f6e\u672c\u5730 Git \u548c Gitee \u4e4b\u95f4\u7684 SSH \u901a\u4fe1\uff0c\u5e76\u5c06Access Token\u6dfb\u52a0\u5230SSH key\u4e2d\uff0c\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/li>\n<\/ol>\n<pre>ssh-keygen -t rsa -C \"\u4f60\u7684Gitee\u90ae\u7bb1\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6b64\u65f6\u4f1a\u8981\u6c42\u8f93\u5165SSH key\u5b58\u50a8\u8def\u5f84\uff0c\u53ef\u4ee5\u76f4\u63a5\u6309\u201cEnter\u201d\u952e\u4f7f\u7528\u9ed8\u8ba4\u8def\u5f84\u3002\u63a5\u7740\u4f1a\u8981\u6c42\u8f93\u5165\u5bc6\u7801\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6309\u201cEnter\u201d\u952e\u8df3\u8fc7\u3002<\/p>\n<pre>cat ~\/.ssh\/id_rsa.pub | pbcopy<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u547d\u4ee4\u662f\u5c06id_rsa.pub\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\u590d\u5236\u5230\u7c98\u8d34\u677f\u4e2d\uff0c\u7b49\u5f85\u4e0b\u4e00\u6b65\u8fdb\u884c\u7c98\u8d34\u3002<\/p>\n<ol>\n<li>\u56de\u5230Gitee\u5b98\u7f51\uff0c\u5728\u8d26\u53f7\u8bbe\u7f6e\u4e2d\u627e\u5230SSH Keys\u9009\u9879\u5361\uff0c\u521b\u5efa\u65b0\u7684SSH Keys\uff0c\u5e76\u5c06\u7c98\u8d34\u677f\u4e2d\u5df2\u7ecf\u590d\u5236\u597d\u7684Access Token\u6dfb\u52a0\u5230Key\u503c\u4e2d\uff1b<\/li>\n<li>\u6700\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u6d4b\u8bd5\uff1a<\/li>\n<\/ol>\n<pre>ssh git@gitee.com<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u51fa\u73b0\u201cHi XXX! You&#8217;ve successfully authenticated, but Gitee.com does not provide shell access.\u201d\u5219\u8868\u793a\u914d\u7f6e\u5b8c\u6210\uff0c\u73b0\u5728\u4f60\u53ef\u4ee5\u81ea\u5982\u5730\u4f7f\u7528Gitee\u6258\u7ba1\u81ea\u5df1\u7684\u4ee3\u7801\u4e86\u3002<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4ee5\u4e0a\u6b65\u9aa4\u662f\u4e3a\u4e86\u4ece\u672c\u5730\u4ee3\u7801\u5e93\u5411Gitee\u8fdb\u884cpush\u548cpull\u64cd\u4f5c\uff0c\u5982\u679c\u9700\u8981\u4eceGitee\u5411\u672c\u5730\u4ee3\u7801\u5e93\u8fdb\u884cclone\u64cd\u4f5c\uff0c\u5219\u9700\u8981\u5728Gitee\u4e2d\u914d\u7f6e\u201cSSH\u516c\u94a5\u201d\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fgitee\u5982\u4f55\u914d\u7f6e\u672c\u5730\u8d26\u53f7\u548c\u5bc6\u7801\uff08\u6b65\u9aa4\uff09\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\u4f7f\u7528gitee\u8fdb\u884c\u4ee3\u7801\u6258\u7ba1\u548c\u56e2\u961f\u534f\u4f5c\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u914d\u7f6e\u672c\u5730\u8d26\u53f7\u548c\u5bc6\u7801\uff0c\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a \u5728Gitee\u5b98\u7f51\u6ce8\u518c\u5e76\u767b\u9646\u8d26\u53f7\uff1b \u5728\u8d26\u53f7\u8bbe\u7f6e\u4e2d\u627e\u5230\u201cAccess Token\u201d\u9009\u9879\u5361\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Access Token\uff0c\u5e76\u5c06Token\u503c\u4fdd\u5b58\u5728\u672c\u5730\uff0c\u5f85\u4f1a\u513f\u4f1a\u7528\u5230\uff1b \u4e0b\u8f7d\u5e76\u5b89\u88c5Git\u5ba2\u6237\u7aef\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\u5728\u547d\u4ee4\u884c\u7a97\u53e3\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u884c\uff1a git config &#8211;global user.name &#8220;\u4f60\u7684Gitee\u7528\u6237\u540d&#8221; git config &#8211;global user.email &#8220;\u4f60\u7684Gitee\u6ce8\u518c\u90ae\u7bb1&#8221; git config &#8211;global credential.helper store \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d\u7b2c\u4e09\u884c\u547d\u4ee4\u662f\u5c06\u672c\u5730\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u4fdd\u5b58\uff0c\u907f\u514d\u6bcf\u6b21\u90fd\u9700\u8981\u8f93\u5165\u3002\u5982\u679c\u4e0d\u52a0\u8fd9\u6761\u547d\u4ee4\uff0c\u5728\u6bcf\u6b21 push \u548c pull \u64cd\u4f5c\u7684\u65f6\u5019\u90fd\u9700\u8981\u8f93\u5165\u8d26\u53f7\u548c\u5bc6\u7801\u3002 \u63a5\u4e0b\u6765\u9700\u8981\u8bbe\u7f6e\u672c\u5730 Git \u548c Gitee \u4e4b\u95f4\u7684 SSH \u901a\u4fe1\uff0c\u5e76\u5c06Access Token\u6dfb\u52a0\u5230SSH key\u4e2d\uff0c\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a ssh-keygen -t rsa -C &#8220;\u4f60\u7684Gitee\u90ae\u7bb1&#8221; \u767b\u5f55\u540e\u590d\u5236 \u6b64\u65f6\u4f1a\u8981\u6c42\u8f93\u5165SSH key\u5b58\u50a8\u8def\u5f84\uff0c\u53ef\u4ee5\u76f4\u63a5\u6309\u201cEnter\u201d\u952e\u4f7f\u7528\u9ed8\u8ba4\u8def\u5f84\u3002\u63a5\u7740\u4f1a\u8981\u6c42\u8f93\u5165\u5bc6\u7801\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6309\u201cEnter\u201d\u952e\u8df3\u8fc7\u3002 cat ~\/.ssh\/id_rsa.pub | pbcopy \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u547d\u4ee4\u662f\u5c06id_rsa.pub\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\u590d\u5236\u5230\u7c98\u8d34\u677f\u4e2d\uff0c\u7b49\u5f85\u4e0b\u4e00\u6b65\u8fdb\u884c\u7c98\u8d34\u3002 \u56de\u5230Gitee\u5b98\u7f51\uff0c\u5728\u8d26\u53f7\u8bbe\u7f6e\u4e2d\u627e\u5230SSH Keys\u9009\u9879\u5361\uff0c\u521b\u5efa\u65b0\u7684SSH Keys\uff0c\u5e76\u5c06\u7c98\u8d34\u677f\u4e2d\u5df2\u7ecf\u590d\u5236\u597d\u7684Access Token\u6dfb\u52a0\u5230Key\u503c\u4e2d\uff1b \u6700\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u6d4b\u8bd5\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-19811","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19811","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=19811"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19811\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}