{"id":19067,"date":"2024-11-19T08:38:53","date_gmt":"2024-11-19T00:38:53","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19067\/"},"modified":"2024-11-19T08:38:53","modified_gmt":"2024-11-19T00:38:53","slug":"%e4%b8%a4%e7%a7%8d%e5%b8%b8%e7%94%a8%e7%9a%84ssh-git%e4%bb%a3%e7%90%86%e8%ae%be%e7%bd%ae%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19067\/","title":{"rendered":"\u4e24\u79cd\u5e38\u7528\u7684SSH Git\u4ee3\u7406\u8bbe\u7f6e\u65b9\u6cd5"},"content":{"rendered":"<p>ssh git \u4ee3\u7406\u8bbe\u7f6e<\/p>\n<p>\u5728\u4f7f\u7528 Git \u65f6\uff0c\u5982\u679c\u9047\u5230\u4e0e\u88ab\u5899\u7684 Git \u670d\u52a1\u5668\u901a\u8baf\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u4ee3\u7406\u7684\u65b9\u5f0f\u89e3\u51b3\u3002\u672c\u6587\u5c06\u63d0\u4f9b\u4e24\u79cd\u5e38\u7528\u7684 ssh git \u4ee3\u7406\u8bbe\u7f6e\u65b9\u6cd5\uff0c\u5e2e\u52a9\u8bfb\u8005\u987a\u5229\u5730\u4f7f\u7528 Git\u3002<\/p>\n<p>\u7b2c\u4e00\u79cd\u65b9\u6cd5\uff1a\u8bbe\u7f6e SSH \u4ee3\u7406<\/p>\n<p>\u5728\u4f7f\u7528 Git \u65f6\uff0c\u6211\u4eec\u4e00\u822c\u4f1a\u4f7f\u7528 SSH \u534f\u8bae\u8fdb\u884c\u6570\u636e\u4f20\u8f93\u3002\u56e0\u6b64\uff0c\u4e3a\u4e86\u5b9e\u73b0\u4ee3\u7406\u7684\u8bbe\u7f6e\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539 SSH \u7684\u914d\u7f6e\u6587\u4ef6\u3002\u4e0b\u9762\u662f\u5177\u4f53\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef<\/li>\n<li>\n<p>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u5165 SSH \u914d\u7f6e\u76ee\u5f55<\/p>\n<pre>cd ~\/.ssh<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236  <\/li>\n<li>\n<p>\u521b\u5efa\u6216\u7f16\u8f91 config \u6587\u4ef6<\/p>\n<pre>touch config\nvim config<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236  <\/li>\n<li>\n<p>\u5728 config \u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff08\u5047\u8bbe\u4ee3\u7406\u5730\u5740\u4e3a 127.0.0.1:1080\uff09<\/p>\n<pre>Host github.com\n    HostName github.com\n    User git\n    ProxyCommand nc -x 127.0.0.1:1080 %h %p<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236  <\/li>\n<li>\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u8bbe\u7f6e SSH \u4ee3\u7406\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u901a\u8fc7 SSH \u534f\u8bae\u987a\u5229\u5730\u4e0e Git \u670d\u52a1\u5668\u901a\u8baf\u4e86\u3002<\/p>\n<p>\u7b2c\u4e8c\u79cd\u65b9\u6cd5\uff1a\u8bbe\u7f6e Git \u4ee3\u7406<\/p>\n<p>\u5982\u679c\u6211\u4eec\u4e0d\u60f3\u4fee\u6539 SSH \u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e Git \u7684\u914d\u7f6e\u6587\u4ef6\u6765\u5b9e\u73b0\u4ee3\u7406\u7684\u8bbe\u7f6e\u3002\u4e0b\u9762\u662f\u5177\u4f53\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef<\/li>\n<li>\n<p>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u5165 Git \u914d\u7f6e\u76ee\u5f55<\/p>\n<pre>cd ~\/.gitconfig<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236  <\/li>\n<li>\n<p>\u521b\u5efa\u6216\u7f16\u8f91 config \u6587\u4ef6<\/p>\n<pre>touch config\nvim config<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    \u767b\u5f55\u540e\u590d\u5236  <\/li>\n<li>\n<p>\u5728 config \u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff08\u5047\u8bbe\u4ee3\u7406\u5730\u5740\u4e3a 127.0.0.1:1080\uff09<\/p>\n<pre>[http]\n    proxy = socks5:\/\/127.0.0.1:1080\n\n[https]\n    proxy = socks5:\/\/127.0.0.1:1080<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236  <\/li>\n<li>\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u8bbe\u7f6e Git \u4ee3\u7406\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u901a\u8fc7 Git \u8bbf\u95ee\u88ab\u5899\u7684 Git \u670d\u52a1\u5668\u4e86\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u4e24\u79cd\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u5b9e\u73b0 SSH Git \u7684\u4ee3\u7406\u8bbe\u7f6e\u3002\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u7545\u901a\u65e0\u963b\u5730\u4f7f\u7528 Git \u4e86\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4ee3\u7406\u5730\u5740\u9700\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8fdb\u884c\u8bbe\u7f6e\u3002\u540c\u65f6\uff0c\u6211\u4eec\u4e5f\u8981\u786e\u4fdd\u4ee3\u7406\u670d\u52a1\u5668\u7684\u7a33\u5b9a\u6027\u548c\u5b89\u5168\u6027\uff0c\u907f\u514d\u9020\u6210\u4efb\u4f55\u4e0d\u5fc5\u8981\u7684\u635f\u5931\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e24\u79cd\u5e38\u7528\u7684SSH Git\u4ee3\u7406\u8bbe\u7f6e\u65b9\u6cd5\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>ssh git \u4ee3\u7406\u8bbe\u7f6e \u5728\u4f7f\u7528 Git \u65f6\uff0c\u5982\u679c\u9047\u5230\u4e0e\u88ab\u5899\u7684 Git \u670d\u52a1\u5668\u901a\u8baf\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u4ee3\u7406\u7684\u65b9\u5f0f\u89e3\u51b3\u3002\u672c\u6587\u5c06\u63d0\u4f9b\u4e24\u79cd\u5e38\u7528\u7684 ssh git \u4ee3\u7406\u8bbe\u7f6e\u65b9\u6cd5\uff0c\u5e2e\u52a9\u8bfb\u8005\u987a\u5229\u5730\u4f7f\u7528 Git\u3002 \u7b2c\u4e00\u79cd\u65b9\u6cd5\uff1a\u8bbe\u7f6e SSH \u4ee3\u7406 \u5728\u4f7f\u7528 Git \u65f6\uff0c\u6211\u4eec\u4e00\u822c\u4f1a\u4f7f\u7528 SSH \u534f\u8bae\u8fdb\u884c\u6570\u636e\u4f20\u8f93\u3002\u56e0\u6b64\uff0c\u4e3a\u4e86\u5b9e\u73b0\u4ee3\u7406\u7684\u8bbe\u7f6e\uff0c\u6211\u4eec\u9700\u8981\u4fee\u6539 SSH \u7684\u914d\u7f6e\u6587\u4ef6\u3002\u4e0b\u9762\u662f\u5177\u4f53\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a \u6253\u5f00\u7ec8\u7aef \u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u5165 SSH \u914d\u7f6e\u76ee\u5f55 cd ~\/.ssh \u767b\u5f55\u540e\u590d\u5236 \u521b\u5efa\u6216\u7f16\u8f91 config \u6587\u4ef6 touch config vim config \u767b\u5f55\u540e\u590d\u5236 \u767b\u5f55\u540e\u590d\u5236 \u5728 config \u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff08\u5047\u8bbe\u4ee3\u7406\u5730\u5740\u4e3a 127.0.0.1:1080\uff09 Host github.com HostName github.com User git ProxyCommand nc -x 127.0.0.1:1080 %h %p \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-19067","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19067","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=19067"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19067\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}