{"id":5263,"date":"2022-01-22T19:27:40","date_gmt":"2022-01-22T11:27:40","guid":{"rendered":"https:\/\/www.systemsci.org\/jinshanw\/?p=5263"},"modified":"2022-02-24T19:58:39","modified_gmt":"2022-02-24T11:58:39","slug":"%e4%bb%a3%e7%a0%81%e5%90%8c%e6%97%b6%e6%9b%b4%e6%96%b0%e5%88%b0gitee%e5%92%8cgithub","status":"publish","type":"post","link":"https:\/\/www.systemsci.org\/jinshanw\/2022\/01\/22\/%e4%bb%a3%e7%a0%81%e5%90%8c%e6%97%b6%e6%9b%b4%e6%96%b0%e5%88%b0gitee%e5%92%8cgithub\/","title":{"rendered":"\u4ee3\u7801\u540c\u65f6\u66f4\u65b0\u5230Gitee\u548cgithub"},"content":{"rendered":"\n<p>\u7531\u4e8e\u56fd\u5185\u540c\u6b65\u5230Gitee\u66f4\u65b9\u4fbf\uff0c\u56fd\u5916\u540c\u6b65\u5230github\u66f4\u65b9\u4fbf\uff0c\u9700\u8981\u628a\u540c\u4e00\u5957\u4ee3\u7801\u540c\u65f6\u540c\u6b65\u5230Gitee\u548cgithub\u3002\u628a\u8fd9\u4e2a\u8fc7\u7a0b\u8bb0\u5f55\u4e0b\u6765\u3002<\/p>\n\n\n\n<p>\u540c\u65f6\uff0c\u7531\u4e8egithub\u7981\u6b62\u4e86\u7528\u6237\u540d\u548c\u5bc6\u7801\u6765\u8ba4\u8bc1\uff0c\u56e0\u6b64\uff0c\u8fd9\u91cc\u5bf9\u4e8eGitee\u548cgithub\u7edf\u4e00\u91c7\u7528ssh\u8ba4\u8bc1\u3002\u6ce8\u610f\uff0c\u9009\u62e9ssh\u8ba4\u8bc1\u4e4b\u540e\uff0c\u4ee3\u7801\u5e93clone\u7684\u547d\u4ee4\u7684\u7ec6\u8282\u4f1a\u548c\u7528https\u7684\u65b9\u5f0f\u4e0d\u540c\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e00\u6b65\uff0c\u751f\u6210ssh key\u516c\u94a5\u548c\u79c1\u94a5\u5bf9\u3002\u53ef\u4ee5\u91c7\u7528\u4e0d\u540c\u7684\u534f\u8bae\u3002\u5728\u8fd9\u91cc\u7528rsa\u683c\u5f0f\u3002\u8fdb\u5165~\/.ssh\u76ee\u5f55\u4e0b\uff0c\u8f93\u5165\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ssh-keygen -t ed22519 -C \"YourGIthubEmailbox\" -f \"github_id_rsa\" <\/pre>\n\n\n\n<p id=\"block-5aed0bec-ae3e-477a-b7fe-ccaa34b2eec4\">\u76f4\u63a5\u4e24\u6b21\u56de\u8f66\uff0e\u4f1a\u5728\u6587\u4ef6\u5939\u4e0b\u751f\u6210github_id_rsa\u548cgithub_id_rsa.pub\uff0eGitee\u5df2\u7ecf\u4e0d\u5141\u8bb8rsa\u7f16\u7801\u7684\u516c\u94a5\uff0c\u56e0\u6b64\uff0c\u6539\u6210ed22519\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e8c\u6b65\uff0c\u628agithub_id_rsa.pub\u7684\u5185\u5bb9\u6dfb\u52a0\u5230github\u7684SSH Keys\u4e2d\uff0c\u53d6\u4e2a\u540d\u5b57\uff0c\u4fdd\u5b58\u3002<\/p>\n\n\n\n<p>\u9488\u5bf9Gitee\uff0c\u91cd\u590d\u8fd9\u4e2a\u8fc7\u7a0b\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e09\u6b65\uff0c\u5728<code>~\/.ssh<\/code>\u6587\u4ef6\u5939\u4e0b\u65b0\u5efa<code>config<\/code>\u6587\u4ef6\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># gitee \n \nHost gitee.com \nHostName gitee.com \nPreferredAuthentications publickey \nIdentityFile ~\/.ssh\/gitee_id_rsa \n \n# github \n \nHost github.com \nHostName github.com \nPreferredAuthentications publickey IdentityFile ~\/.ssh\/github_id_rsa <\/pre>\n\n\n\n<p>\u7b2c\u56db\u6b65\uff0c\u6dfb\u52a0\u8bc6\u522b SSH keys \u65b0\u7684\u79c1\u94a5\u3002\u4e3a\u4e86\u8ba9 SSH \u8bc6\u522b\u65b0\u7684\u79c1\u94a5\uff0c\u9700\u8981\u5c06\u65b0\u7684\u79c1\u94a5\u52a0\u5165\u5230 SSH agent \u4e2d <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ssh-agent bash  \n$ ssh-add ~\/.ssh\/github_id_rsa\n$ ssh-add ~\/.ssh\/gitee_id_rsa<\/pre>\n\n\n\n<p>\u7b2c\u4e94\u6b65\uff0c\u6d4b\u8bd5\u662f\u5426\u8fde\u63a5\u6210\u529f\u3002\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\uff0c\u770b\u662f\u5426\u53d7\u5230\u6b22\u8fce\u4fe1\u606f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ssh -T git@github.com\n$ ssh -T git@gitee.com<\/pre>\n\n\n\n<p>\u8fd9\u6837\u8ba4\u8bc1\u65b9\u5f0f\u5c31\u8bbe\u7f6e\u597d\u4e86\u3002\u4e0b\u9762\uff0c\u6211\u4eec\u6765\u5efa\u7acb\u4ee3\u7801\u5e93\uff0c\u6765\u4f7f\u7528\u8fd9\u4e2assh key\u8ba4\u8bc1\u65b9\u5f0f\u548cGitee\u4ee5\u53cagithub\u8fde\u63a5\u3002<\/p>\n\n\n\n<p>\u7b2c\u4e00\uff0c\u5efa\u7acb\u672c\u5730\u4ee3\u7801\u5e93\u548c\u8fdc\u7a0b\u76f8\u8fde\u3002\u5047\u8bbeGitee\u548cgithub\u90fd\u5df2\u7ecf\u5efa\u7acb\u4ee3\u7801\u5e93\uff0ctest.git\u3002\u6211\u4eec\u9700\u8981\u67e5\u770b\u4ee3\u7801\u5e93\uff0c\u83b7\u53d6\u8fd9\u4e2a\u4ee3\u7801\u5e93\u7684ssh\u8bbf\u95ee\u5730\u5740\uff0c\u4f8b\u5982 git@gitee.com:XXX\/test.git\u3002\u7136\u540e\u628a\u8fd9\u4e2a\u5730\u5740\u901a\u8fc7 git clone\u548cgit remote add\u4ece\u5176\u4e2d\u4e00\u4e2a\u8fdc\u7a0b\u4ee3\u7801\u5e93\u521b\u5efa\u672c\u5730\u4ee3\u7801\u5e93\uff0c\u4ee5\u53ca\u628a\u65b0\u521b\u5efa\u7684\u672c\u5730\u4ee3\u7801\u5e93\u8fde\u63a5\u5230\u53e6\u4e00\u4e2a\u8fdc\u7a0b\u4ee3\u7801\u5e93\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ git clone git@gitee.com:XXX\/test.git\n$ git remote add github git@github.com:XXX\/test.git<\/pre>\n\n\n\n<p>\u7b2c\u4e8c\uff0c\u540c\u6b65\u4ee3\u7801\u5e93\u3002\u7528git config -e \u6216\u8005\u7528\u547d\u4ee4\u884cgit remote set-url origin\u6765\u4fee\u6539config\u6587\u4ef6\uff0c\u5f97\u5230\u4ee5\u4e0b\u7684\u6548\u679c\uff08\u4e5f\u5c31\u662forigin\u4e0b\u9762\u5305\u542b\u4e24\u4e2a\u8fdc\u7a0b\u5e93\u7684\u4fe1\u606f\uff0c\u4e24\u4e2a\u8fdc\u7a0b\u5e93\u5206\u522b\u6709\u81ea\u5df1\u7684\u540d\u5b57\u548c\u4fe1\u606f\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[core]\nrepositoryformatversion = 0\nfilemode = true\nbare = false\nlogallrefupdates = true\n[remote \"origin\"]\nurl = git@gitee.com:XXX\/test.git\nurl = git@github.com:XXX\/test.git\n[branch \"master\"]\nremote = origin\nmerge = refs\/heads\/master\n[remote \"github\"]\nurl = git@github.com:XXX\/test.git\nfetch = +refs\/heads\/<em>:refs\/remotes\/github\/<\/em>\n[remote \"gitee\"]\nurl = git@gitee.com:XXX\/test.git\nfetch = +refs\/heads\/<em>:refs\/remotes\/gitee\/<\/em><\/pre>\n\n\n\n<p>\u6709\u4e86\u8fd9\u4e2a\u72b6\u6001\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7git add\uff0cgit commit\u548cgit push \u6765\u540c\u65f6\u628a\u672c\u5730\u5e93\u6587\u4ef6push\u7ed9\u4e24\u4e2a\u8fdc\u7a0b\u5e93\uff0c\u4ee5\u53ca\u7528git pull\u6765\u4ece\u4e24\u4e2a\u8fdc\u7a0b\u5e93pull\u5230\u672c\u5730\u3002\u5982\u679c\u9700\u8981\u9488\u5bf9\u72ec\u81ea\u8fdc\u7a0b\u5e93\u7684push\u548cpull\uff0c\u5219\u7528\u76f8\u5e94\u7684\u540d\u79f0\uff0cgitee\u548cgithub\u5c31\u53ef\u4ee5\u3002\u4f8b\u5982<\/p>\n\n\n\n<p>git remote update \u540c\u65f6\u4ece\u4e24\u4e2a\u5e93\u62c9\u8fc7\u6765\u672c\u5730\uff1b<\/p>\n\n\n\n<p>git pull github master \u4ec5\u4ec5\u4ecegithub\u5e93\u62c9\u8fc7\u6765\u672c\u5730\uff1b<\/p>\n\n\n\n<p>git push github \u4ec5\u4ec5\u4ece\u672c\u5730\u63a8\u9001\u5230github\u3002<\/p>\n\n\n\n<p>\u5f53\u7136\uff0c\u5982\u679c\u53ea\u4e3a\u4e86\u540c\u6b65\u901f\u5ea6\uff0c\u4ec5\u4ec5\u4f7f\u7528Gitee\u4e5f\u53ef\u4ee5\uff0c\u53ea\u9700\u8981\u628aGitee\u7684ip\u5730\u5740\u4fee\u6539\u6210154.213.2.253\u3002\u8fd9\u4e2a\u5730\u5740\u5bf9\u4e8e\u56fd\u5916\u7528\u6237\uff0c\u4f1a\u5feb\u5f88\u591a\u5f88\u591a\u3002\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\/etc\/hosts\u6587\u4ef6\uff0c\u6216\u8005\u4fee\u6539ssh\u4e0b\u7684config\u6587\u4ef6\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8e\u56fd\u5185\u540c\u6b65\u5230Gitee\u66f4\u65b9\u4fbf\uff0c\u56fd\u5916\u540c\u6b65\u5230github\u66f4\u65b9\u4fbf\uff0c\u9700\u8981\u628a\u540c\u4e00\u5957\u4ee3\u7801\u540c\u65f6\u540c\u6b65\u5230Gitee\u548cgithu &hellip; <a href=\"https:\/\/www.systemsci.org\/jinshanw\/2022\/01\/22\/%e4%bb%a3%e7%a0%81%e5%90%8c%e6%97%b6%e6%9b%b4%e6%96%b0%e5%88%b0gitee%e5%92%8cgithub\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u4ee3\u7801\u540c\u65f6\u66f4\u65b0\u5230Gitee\u548cgithub\u201d<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[23],"_links":{"self":[{"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/posts\/5263"}],"collection":[{"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/comments?post=5263"}],"version-history":[{"count":8,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/posts\/5263\/revisions"}],"predecessor-version":[{"id":5285,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/posts\/5263\/revisions\/5285"}],"wp:attachment":[{"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/media?parent=5263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/categories?post=5263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/tags?post=5263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}