{"id":21571,"date":"2024-11-19T17:53:08","date_gmt":"2024-11-19T09:53:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21571\/"},"modified":"2024-11-19T17:53:08","modified_gmt":"2024-11-19T09:53:08","slug":"git%e6%80%8e%e4%b9%88%e7%94%9f%e6%88%90ssh%e5%af%86%e9%92%a5","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21571\/","title":{"rendered":"git\u600e\u4e48\u751f\u6210ssh\u5bc6\u94a5"},"content":{"rendered":"<blockquote><p>\n  \u4e3a\u4e86\u5b89\u5168\u8fde\u63a5\u8fdc\u7a0b git \u670d\u52a1\u5668\uff0c\u9700\u8981\u751f\u6210\u5305\u542b\u516c\u94a5\u548c\u79c1\u94a5\u7684 ssh \u5bc6\u94a5\u3002\u751f\u6210 ssh \u5bc6\u94a5\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u547d\u4ee4 ssh-keygen -t rsa -b 4096\u3002\u9009\u62e9\u5bc6\u94a5\u4fdd\u5b58\u4f4d\u7f6e\u3002\u8f93\u5165\u5bc6\u7801\u77ed\u8bed\u4ee5\u4fdd\u62a4\u79c1\u94a5\u3002\u5c06\u516c\u94a5\u590d\u5236\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u3002\u5c06\u79c1\u94a5\u59a5\u5584\u4fdd\u5b58\uff0c\u56e0\u4e3a\u5b83\u662f\u8bbf\u95ee\u5e10\u6237\u7684\u51ed\u636e\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/31\/2024053100213686746.jpg\" class=\"aligncenter\" title=\"git\u600e\u4e48\u751f\u6210ssh\u5bc6\u94a5\u63d2\u56fe\" alt=\"git\u600e\u4e48\u751f\u6210ssh\u5bc6\u94a5\u63d2\u56fe\" \/><\/p>\n<p><strong>\u751f\u6210 SSH \u5bc6\u94a5<\/strong><\/p>\n<p>\u4e3a\u4e86\u5b89\u5168\u5730\u8fde\u63a5\u5230\u8fdc\u7a0b Git \u670d\u52a1\u5668\uff0c\u9700\u8981\u751f\u6210 SSH \u5bc6\u94a5\u3002SSH \u5bc6\u94a5\u5305\u542b\u516c\u94a5\u548c\u79c1\u94a5\uff0c\u516c\u94a5\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u79c1\u94a5\u5b58\u50a8\u5728\u672c\u5730\u8ba1\u7b97\u673a\u4e0a\u3002<\/p>\n<p><strong>\u751f\u6210 SSH \u5bc6\u94a5\u7684\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/strong><\/li>\n<li>\n<p><strong>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/strong><\/p>\n<pre>ssh-keygen -t rsa -b 4096<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li><strong>\u6309 Enter \u952e\u3002<\/strong><\/li>\n<li> <strong>\u9009\u62e9\u8981\u4fdd\u5b58\u5bc6\u94a5\u7684\u4f4d\u7f6e\u3002<\/strong>\u9ed8\u8ba4\u4f4d\u7f6e\u4e3a ~\/.ssh \u76ee\u5f55\u3002<\/li>\n<li> <strong>\u8f93\u5165\u4e00\u4e2a\u5bc6\u7801\u77ed\u8bed\u3002<\/strong>\u6b64\u5bc6\u7801\u77ed\u8bed\u5c06\u7528\u4e8e\u4fdd\u62a4\u79c1\u94a5\u3002<\/li>\n<li><strong>\u518d\u6b21\u8f93\u5165\u5bc6\u7801\u77ed\u8bed\u4ee5\u786e\u8ba4\u3002<\/strong><\/li>\n<\/ol>\n<p><strong>\u751f\u6210 SSH \u5bc6\u94a5\u540e\uff1a<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u516c\u94a5\uff08id_rsa.pub\uff09<\/strong><\/p>\n<ul>\n<li>\u5305\u542b\u5728 ~\/.ssh \u76ee\u5f55\u4e2d\u3002<\/li>\n<li>\u5c06\u6b64\u5bc6\u94a5\u590d\u5236\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\uff0c\u4ee5\u4fbf\u670d\u52a1\u5668\u80fd\u591f\u8bc6\u522b\u60a8\u7684\u8eab\u4efd\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u79c1\u94a5\uff08id_rsa\uff09<\/strong><\/p>\n<ul>\n<li>\u5305\u542b\u5728 ~\/.ssh \u76ee\u5f55\u4e2d\u3002<\/li>\n<li>\u8bf7\u52a1\u5fc5\u59a5\u5584\u4fdd\u5b58\u6b64\u5bc6\u94a5\uff0c\u56e0\u4e3a\u5b83\u53ef\u7528\u4e8e\u8bbf\u95ee\u60a8\u7684\u5e10\u6237\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>\u5c06\u516c\u94a5\u6dfb\u52a0\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/strong><\/li>\n<li>\n<p><strong>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/strong><\/p>\n<pre>ssh-copy-id user@example.com<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li><strong>\u66ff\u6362 user \u4e3a\u60a8\u7684\u7528\u6237\u540d\uff0cexample.com \u4e3a\u670d\u52a1\u5668\u5730\u5740\u3002<\/strong><\/li>\n<li><strong>\u6309 Enter \u952e\u3002<\/strong><\/li>\n<li><strong>\u8f93\u5165\u5bc6\u7801\u3002<\/strong><\/li>\n<li><strong>\u516c\u94a5\u5c06\u6dfb\u52a0\u5230\u670d\u52a1\u5668\u4e0a\u3002<\/strong><\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u751f\u6210ssh\u5bc6\u94a5\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>\u4e3a\u4e86\u5b89\u5168\u8fde\u63a5\u8fdc\u7a0b git \u670d\u52a1\u5668\uff0c\u9700\u8981\u751f\u6210\u5305\u542b\u516c\u94a5\u548c\u79c1\u94a5\u7684 ssh \u5bc6\u94a5\u3002\u751f\u6210 ssh \u5bc6\u94a5\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u547d\u4ee4 ssh-keygen -t rsa -b 4096\u3002\u9009\u62e9\u5bc6\u94a5\u4fdd\u5b58\u4f4d\u7f6e\u3002\u8f93\u5165\u5bc6\u7801\u77ed\u8bed\u4ee5\u4fdd\u62a4\u79c1\u94a5\u3002\u5c06\u516c\u94a5\u590d\u5236\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\u3002\u5c06\u79c1\u94a5\u59a5\u5584\u4fdd\u5b58\uff0c\u56e0\u4e3a\u5b83\u662f\u8bbf\u95ee\u5e10\u6237\u7684\u51ed\u636e\u3002 \u751f\u6210 SSH \u5bc6\u94a5 \u4e3a\u4e86\u5b89\u5168\u5730\u8fde\u63a5\u5230\u8fdc\u7a0b Git \u670d\u52a1\u5668\uff0c\u9700\u8981\u751f\u6210 SSH \u5bc6\u94a5\u3002SSH \u5bc6\u94a5\u5305\u542b\u516c\u94a5\u548c\u79c1\u94a5\uff0c\u516c\u94a5\u5b58\u50a8\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u79c1\u94a5\u5b58\u50a8\u5728\u672c\u5730\u8ba1\u7b97\u673a\u4e0a\u3002 \u751f\u6210 SSH \u5bc6\u94a5\u7684\u6b65\u9aa4\uff1a \u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u3002 \u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a ssh-keygen -t rsa -b 4096 \u767b\u5f55\u540e\u590d\u5236 \u6309 Enter \u952e\u3002 \u9009\u62e9\u8981\u4fdd\u5b58\u5bc6\u94a5\u7684\u4f4d\u7f6e\u3002\u9ed8\u8ba4\u4f4d\u7f6e\u4e3a ~\/.ssh \u76ee\u5f55\u3002 \u8f93\u5165\u4e00\u4e2a\u5bc6\u7801\u77ed\u8bed\u3002\u6b64\u5bc6\u7801\u77ed\u8bed\u5c06\u7528\u4e8e\u4fdd\u62a4\u79c1\u94a5\u3002 \u518d\u6b21\u8f93\u5165\u5bc6\u7801\u77ed\u8bed\u4ee5\u786e\u8ba4\u3002 \u751f\u6210 SSH \u5bc6\u94a5\u540e\uff1a \u516c\u94a5\uff08id_rsa.pub\uff09 \u5305\u542b\u5728 ~\/.ssh \u76ee\u5f55\u4e2d\u3002 \u5c06\u6b64\u5bc6\u94a5\u590d\u5236\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0a\uff0c\u4ee5\u4fbf\u670d\u52a1\u5668\u80fd\u591f\u8bc6\u522b\u60a8\u7684\u8eab\u4efd\u3002 \u79c1\u94a5\uff08id_rsa\uff09 \u5305\u542b\u5728 ~\/.ssh \u76ee\u5f55\u4e2d\u3002 \u8bf7\u52a1\u5fc5\u59a5\u5584\u4fdd\u5b58\u6b64\u5bc6\u94a5\uff0c\u56e0\u4e3a\u5b83\u53ef\u7528\u4e8e\u8bbf\u95ee\u60a8\u7684\u5e10\u6237\u3002 \u5c06\u516c\u94a5\u6dfb\u52a0\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\uff1a \u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u3002 [&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-21571","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21571","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=21571"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21571\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}