{"id":1156,"date":"2018-03-08T15:45:56","date_gmt":"2018-03-08T07:45:56","guid":{"rendered":"https:\/\/www.toodyao.com\/?p=1156"},"modified":"2018-03-08T15:45:56","modified_gmt":"2018-03-08T07:45:56","slug":"%e8%a7%a3%e5%86%b3git-push%e6%97%b6%e6%af%8f%e6%ac%a1%e9%83%bd%e8%a6%81%e8%be%93%e5%85%a5github%e7%94%a8%e6%88%b7%e5%90%8d%e5%92%8c%e5%af%86%e7%a0%81%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/www.toodyao.com\/?p=1156","title":{"rendered":"\u89e3\u51b3git push\u65f6\u6bcf\u6b21\u90fd\u8981\u8f93\u5165Github\u7528\u6237\u540d\u548c\u5bc6\u7801\u7684\u95ee\u9898"},"content":{"rendered":"<h1>0.\u00a0\u5206\u6790<\/h1>\n<p>\u5728\u6267\u884c<span class=\"lang:default highlight:0 decode:true  crayon-inline \">git push<\/span>\u00a0\u65f6\uff0c\u6709\u65f6\u5019\u4f1a\u8981\u6c42\u9a8c\u8bc1\u7528\u6237\u540d\u5bc6\u7801\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">$ git push origin master\nfatal: AggregateException encountered.\n   One or more errors occurred.\nUsername for 'https:\/\/github.com':<\/pre>\n<p>\u660e\u660e\u6dfb\u52a0\u4e86SSH\u00a0key\u4e86\uff0c\u8fd8\u662f\u8981\u9a8c\u8bc1\uff0c\u5f88\u4e0d\u65b9\u4fbf<\/p>\n<p>\u51fa\u73b0\u8fd9\u79cd\u95ee\u9898\u7684\u539f\u56e0\u662f\u4f7f\u7528https\u7684\u65b9\u5f0f\u6dfb\u52a0\u7684\u8fdc\u7a0b\u4ed3\u5e93\uff0c\u800c\u4e0d\u662fSSH\u7684\u65b9\u5f0f<\/p>\n<h1>1.\u00a0\u89e3\u51b3<\/h1>\n<p>\u786e\u8ba4\u4f60\u5728Github\u4e2d\u6dfb\u52a0\u4e86SSH\u00a0key\uff0c\u5173\u4e8e\u5982\u4f55\u5728Github\u4e2d\u6dfb\u52a0SSH\u00a0key\uff0c\u8bf7\u53c2\u8003\uff1a<a href=\"https:\/\/help.github.com\/articles\/connecting-to-github-with-ssh\/\">Connecting to GitHub with SSH<\/a>\uff0c\u6216\u81ea\u884c\u641c\u7d22\uff0c\u5728\u6b64\u4e0d\u518d\u8d58\u8ff0\u3002<\/p>\n<p>\u4f7f\u7528<span class=\"lang:default highlight:0 decode:true  crayon-inline\">git remote -v<\/span>\u00a0\u67e5\u770b\u5bf9\u5e94\u7684\u514b\u9686\u5730\u5740<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">git remote -v\norigin  https:\/\/github.com\/username\/repository.git (fetch)\norigin  https:\/\/github.com\/username\/repository.git (push)<\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u786e\u5b9e\u662f\u4ee5https\u65b9\u5f0fclone\u7684<\/p>\n<p>\u5220\u9664\u5e76\u91cd\u65b0\u6dfb\u52a0\uff1a<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">git remote rm origin\ngit remote add origin git@github.com:username\/repository.git<\/pre>\n<p>SSH\u7684\u94fe\u63a5\u53ef\u4ee5\u76f4\u63a5\u5728\u9879\u76ee\u9875\u590d\u5236<\/p>\n<p><a href=\"https:\/\/www.toodyao.com\/wp-content\/uploads\/2018\/03\/Capture.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1157\" src=\"https:\/\/www.toodyao.com\/wp-content\/uploads\/2018\/03\/Capture.png\" alt=\"\" width=\"269\" height=\"131\" \/><\/a><\/p>\n<p>\u91cd\u65b0\u67e5\u770bclone\u5730\u5740<span class=\"lang:default highlight:0 decode:true  crayon-inline \">git remote -v<\/span><\/p>\n<pre class=\"lang:default highlight:0 decode:true\">git remote -v\norigin  git@github.com:username\/repository.git (fetch)\norigin  git@github.com:username\/repository.git (push)<\/pre>\n<p>\u5df2\u7ecf\u6539\u4e3aSSH\u7684\u65b9\u5f0f\u4e86<\/p>\n<p>push\u4e00\u4e0b<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">git push -u origin master<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6b64\u65b9\u6cd5\u53ea\u9488\u5bf9\u5f53\u524d\u9879\u76ee\uff0c\u5176\u4ed6\u9879\u76ee\u8981\u91cd\u65b0\u8d70\u4e00\u904d\u8fd9\u4e2a\u6d41\u7a0b<\/p>\n<hr \/>\n<p><span style=\"color: #808080;\">\u53c2\u8003\uff1a<a style=\"color: #808080;\" href=\"https:\/\/segmentfault.com\/q\/1010000004596130\">https:\/\/segmentfault.com\/q\/1010000004596130<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>0.\u00a0\u5206\u6790 \u5728\u6267\u884cgit push\u00a0\u65f6\uff0c\u6709\u65f6\u5019\u4f1a\u8981\u6c42\u9a8c\u8bc1\u7528\u6237\u540d\u5bc6\u7801\uff0c\u5982\u4e0b\uff1a $ git push origin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-1156","post","type-post","status-publish","format-standard","hentry","category-18"],"_links":{"self":[{"href":"https:\/\/www.toodyao.com\/index.php?rest_route=\/wp\/v2\/posts\/1156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.toodyao.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.toodyao.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.toodyao.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.toodyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1156"}],"version-history":[{"count":1,"href":"https:\/\/www.toodyao.com\/index.php?rest_route=\/wp\/v2\/posts\/1156\/revisions"}],"predecessor-version":[{"id":1158,"href":"https:\/\/www.toodyao.com\/index.php?rest_route=\/wp\/v2\/posts\/1156\/revisions\/1158"}],"wp:attachment":[{"href":"https:\/\/www.toodyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.toodyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.toodyao.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}