{"id":1409,"date":"2020-03-12T22:41:00","date_gmt":"2020-03-12T14:41:00","guid":{"rendered":"https:\/\/www.yumefx.com\/?p=1409"},"modified":"2021-03-03T15:10:59","modified_gmt":"2021-03-03T07:10:59","slug":"git-%e4%bb%a3%e7%90%86%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.yumefx.com\/?p=1409","title":{"rendered":"git \u4ee3\u7406\u8bbe\u7f6e"},"content":{"rendered":"\n<p>\u6709\u65f6\uff0cgit\u9700\u8981\u901a\u8fc7\u4ee3\u7406\u624d\u53ef\u4ee5\u8bbf\u95ee\u5230\u76ee\u6807\u670d\u52a1\u5668\uff0c\u4f8b\u5982github\u8bbf\u95ee\u901f\u5ea6\u6bd4\u8f83\u6162\uff0c\u6216\u8005\u5de5\u4f5c\u7f51\u7edc\u4e0d\u5141\u8bb8\u76f4\u63a5\u8bbf\u95ee\u5916\u7f51\u7b49\u7b49\uff0c\u56e0\u6b64\u8fd9\u4e00\u7bc7\u8bb0\u5f55\u4e00\u4e0bgit\u4ee3\u7406\u8bbe\u7f6e\u3002<\/p>\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">\u4f20\u8f93\u534f\u8bae<\/h1>\n<p>\u9996\u5148\u660e\u786e\u4e00\u4e0bgit clone\u4ed3\u5e93\u65f6\u5e38\u7528\u7684\u51e0\u79cd\u8fde\u63a5\u534f\u8bae\uff0c\u5927\u81f4\u4ee5\u4e0b\u4e09\u79cd\uff1a<\/p>\n<ul>\n<li>https(http)\uff0c\u4f8b\u5982\uff1agit clone https:\/\/github.com\/yumefx\/test.git<\/li>\n<li>ssh\uff0c\u4f8b\u5982\uff1agit clone ssh:\/\/github.com\/yumefx\/test.git<\/li>\n<li>git\uff0c\u4f8b\u5982\uff1agit clone git:\/\/github.com\/yumefx\/test.git<\/li>\n<\/ul>\n<p>\u5176\u4e2d\u7b2c\u4e00\u79cd\u65b9\u5f0f\u53ef\u4ee5\u6539\u6210git clone http:\/\/github.com\/yumefx\/test.git\uff0c\u7531\u4e8e\u81ea\u5e26ssl\u52a0\u5bc6\u7684https\u534f\u8bae\u76f8\u6bd4\u660e\u6587\u4f20\u8f93\u7684http\u66f4\u5b89\u5168\uff0c\u56e0\u6b64\u73b0\u5728\u4e3b\u6d41\u7684git\u670d\u52a1\u5668\u90fd\u8bbe\u7f6e\u4e86http\u8df3\u8f6c\uff0c\u5373\u4f7f\u7528http\u8fde\u63a5\uff0c\u4f1a\u81ea\u52a8\u8df3\u8f6c\u5230https\u8fdb\u884c\u5b9e\u9645clone\u64cd\u4f5c\u3002<\/p>\n<p>\u5728\u547d\u4ee4\u884c\u770b\u5230\u7684\u6548\u679c\u662f\uff1a<\/p>\n\n\n\n<pre>\n<span>git clone  http:\/\/github.com\/yumefx\/test.git <\/span>\n<span>\/\/ Cloning into &#x27;test&#x27; ...<\/span>\n<span>\/\/ warning: redirecting to  https:\/\/github.com\/yumefx\/test.git\/<\/span>\n<span>\/\/ remote:Enumerating objects:2,done<\/span>\n<span>\/\/ ...<\/span>\n<\/pre>\n\n\n\n<p>\u867d\u7136http\u4f1a\u81ea\u52a8\u8df3\u8f6c\u5230https\uff0c\u4f46\u662f\u5728git\u5ba2\u6237\u7aef\u770b\u6765\u4f9d\u7136\u662f\u4e0d\u540c\u7684\u4e24\u4e2a\u534f\u8bae\uff0c\u56e0\u6b64\u8bbe\u7f6e\u4ee3\u7406\u65f6\u9700\u8981\u5206\u522b\u8bbe\u7f6e\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u5177\u4f53\u8bbe\u7f6e\u65b9\u5f0f\u3002<\/p>\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">https(http)\u4ee3\u7406\u8bbe\u7f6e<\/h1>\n<h3>http\u4ee3\u7406<\/h3>\n\n\n\n<pre>\n<span>git config --global http.proxy http:\/\/127.0.0.1:8080<\/span>\n<\/pre>\n\n\n\n<p>\u8bbe\u7f6e\u5b8c\u540e\uff0c\u5728 ~\/.gitconfig \u8fd9\u4e2a\u6587\u4ef6\u4e2d\u4f1a\u627e\u5230\u5bf9\u5e94\u914d\u7f6e<\/p>\n\n\n\n<pre>\n<span>[http]<\/span>\n<span>proxy = http:\/\/127.0.0.1:8080<\/span>\n<\/pre>\n\n\n\n<p>\u4e0d\u4f7f\u7528\u547d\u4ee4\u7684\u8bdd\uff0c\u76f4\u63a5\u521b\u5efa\u6216\u4fee\u6539\u8fd9\u4e2a\u6587\u4ef6\u4e5f\u53ef\u4ee5\u3002<\/p>\n<h5>\u00a0<\/h5>\n<h5>\u53d6\u6d88\u4ee3\u7406<\/h5>\n\n\n\n<pre>\n<span>git config --global --unset http.proxy<\/span>\n<\/pre>\n\n\n\n<h3>\u00a0<\/h3>\n<h3>HTTPS\u8bbe\u7f6e<\/h3>\n<p>\u8ddfHTTP\u4ee3\u7406\u662f\u4e00\u6837\u7684\uff0c\u53ea\u4e0d\u8fc7config\u5bf9\u4e8e\u7684key\u662fhttps.proxy\u3002<\/p>\n\n\n\n<pre>\n<span>#\u8bbe\u7f6ehttps\u4ee3\u7406<\/span>\n<span>git config --global https.proxy http:\/\/127.0.0.1:8080<\/span>\n<span>#\u53d6\u6d88https\u4ee3\u7406<\/span>\n<span>git config --global --unset https.proxy<\/span>\n<\/pre>\n\n\n\n<p>\u5f53\u7136\uff0c\u5982\u679c\u7528socks\u534f\u8bae\uff0c\u53ea\u9700\u8981\u628ahttp:\/\/\u6216\u8005https:\/\/\u66ff\u6362\u4e3asocks5:\/\/\u5373\u53ef<\/p>\n\n\n\n<pre>\n<span>git config --global https.proxy socks5:\/\/127.0.0.1:8080<\/span>\n<\/pre>\n\n\n\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">ssh\u534f\u8bae\u4ee3\u7406<\/h1>\n<p>linux\u4e2d\uff0c\u5728~\/.ssh\/config\u6587\u4ef6\u4e2d\u914d\u7f6e\u5982\u4e0b\uff0c\u5982\u679c\u6ca1\u6709\u5b89\u88c5nc\u7684\u8bdd\uff0c\u9700\u8981\u7528yum\uff08apt-get\uff09\u5b89\u88c5\u597d\u624d\u80fd\u4f7f\u7528\u3002<\/p>\n\n\n\n<pre>\n<span>Host github.com<\/span>\n<span>         HostName github.com<\/span>\n<span>         User git<\/span>\n<span>         Port 22<\/span>\n<span>         ProxyCommand nc --proxy 127.0.0.1:8080 %h %p<\/span>\n<span>         IdentityFile ~\/.ssh\/id_rsa<\/span>\n<\/pre>\n\n\n\n<p>windows\u5e73\u53f0\u7684\u914d\u7f6e\u6587\u4ef6\u4e3aC:\\Users\\administrator\\.ssh\\config\uff0c\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre>\n<span>Host github.com<\/span>\n<span>         User git<\/span>\n<span>         Port 22<\/span>\n<span>         ProxyCommand &quot;C:\/Program Files\/Git\/mingw64\/bin\/connect&quot; -H 127.0.0.1:8080 %h %p<\/span>\n<span>         IdentityFile &quot;C:\\Users\\user.ssh\\id_rsa&quot;<\/span>\n<span>         TCPKeepAlive yes<\/span>\n<span>         IdentitiesOnly yes<\/span>\n<\/pre>\n\n\n\n<p>\u4e24\u4e2a\u8def\u5f84\u6839\u636e\u81ea\u5df1\u7684git\u5b89\u88c5\u76ee\u5f55\u548c\u79c1\u94a5\u4f4d\u7f6e\u81ea\u884c\u4fee\u6539\u3002<\/p>\n\n\n\n<h3>\u00a0<\/h3>\n<h3>ssh\u8fdc\u7a0b\u767b\u5f55\u4ee3\u7406<\/h3>\n<p>\u540c\u7406\uff0c\u4f7f\u7528ssh\u767b\u5f55\u8fdc\u7a0blinux\u670d\u52a1\u5668\u65f6\uff0c\u540c\u6837\u4e5f\u53ef\u4ee5\u4f7f\u7528\u3002<\/p>\n\n\n\n<pre>\n<span>ssh -o ProxyCommand=&#x27;nc --proxy 127.0.0.1:8080 %h %p&#x27; yumefx@192.168.1.15 -p 22<\/span>\n<\/pre>\n\n\n\n<p>\u6216\u8005\u4e5f\u4fdd\u5b58\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u76f4\u63a5ssh yumefx.com\u767b\u5f55\u3002<\/p>\n\n\n\n<pre>\n<span>Host yumefx.com <\/span>\n<span>        HostName 192.168.1.15 <\/span>\n<span>        User yumefx<\/span>\n<span>        Port 22 <\/span>\n<span>        ProxyCommand nc --proxy 127.0.0.1:8080 %h %p <\/span>\n<\/pre>\n\n\n\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">git\u534f\u8bae\u4ee3\u7406<\/h1>\n<p>\u8ddfhttps\u7684\u4ee3\u7406\u8bbe\u7f6e\u65b9\u5f0f\u76f8\u4f3c\uff0cconfig\u7684key\u4e3acore.gitproxy\u3002<\/p>\n\n\n\n<pre>\n<span>#\u8bbe\u7f6egit\u534f\u8bae\u4ee3\u7406<\/span>\n<span>git config --global  core.gitproxy  http:\/\/127.0.0.1:8080<\/span>\n<span>#\u53d6\u6d88git\u534f\u8bae\u4ee3\u7406<\/span>\n<span>git config --global --unset  core.gitproxy  <\/span>\n<\/pre>\n\n\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><span class=\"ask-title\">\u4e16\u754c\u4e0a\u53ea\u6709\u4e00\u79cd\u82f1\u96c4\u4e3b\u4e49\uff0c<\/span><\/p>\n<p><span class=\"ask-title\">\u5c31\u662f\u770b\u6e05\u751f\u6d3b\u7684\u771f\u76f8\u4e4b\u540e\u4f9d\u7136\u70ed\u7231\u751f\u6d3b\u3002<\/span><\/p>\n<p style=\"text-align: right;\">\u2014\u2014\u300a\u7c73\u5f00\u6717\u57fa\u7f57\u300b<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u65f6\uff0cgit\u9700\u8981\u901a\u8fc7\u4ee3\u7406\u624d\u53ef\u4ee5\u8bbf\u95ee\u5230\u76ee\u6807\u670d\u52a1\u5668\uff0c\u4f8b\u5982github\u8bbf\u95ee\u901f\u5ea6\u6bd4\u8f83\u6162\uff0c\u6216\u8005\u5de5\u4f5c\u7f51\u7edc\u4e0d\u5141\u8bb8\u76f4\u63a5\u8bbf\u95ee\u5916\u7f51 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1460,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,4],"tags":[51,14,25],"_links":{"self":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts\/1409"}],"collection":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1409"}],"version-history":[{"count":0,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts\/1409\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/media\/1460"}],"wp:attachment":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}