{"id":592,"date":"2020-06-04T23:20:55","date_gmt":"2020-06-04T15:20:55","guid":{"rendered":"http:\/\/www.guanhaobo.cn\/?p=592"},"modified":"2020-06-04T23:20:55","modified_gmt":"2020-06-04T15:20:55","slug":"github-%e5%bf%ab%e9%80%9f%e5%85%a5%e9%97%a8","status":"publish","type":"post","link":"https:\/\/www.guanhaobo.cn\/?p=592","title":{"rendered":"Github \u5feb\u901f\u5165\u95e8"},"content":{"rendered":"<h3>0 \u5f15\u8a00<\/h3>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u4e86\u5982\u4f55\u65b0\u5efa\u81ea\u5df1\u7684\u4ed3\u5e93\uff0c\u5e76\u4f7f\u7528<code>git<\/code>\u547d\u4ee4\u628a\u672c\u5730\u7684\u4ee3\u7801\u4e0a\u4f20\u5230 github \u4e0a\uff0c\u4f46\u5e76\u4e0d\u662f\u975e\u5e38\u8be6\u7ec6 github \u6559\u7a0b\u3002<br \/>\n\u5982\u679c\u4f60\u53ea\u662f\u60f3\u4e0b\u8f7d\u522b\u4eba\u7684\u4ee3\u7801\uff0c\u76f4\u63a5\u4f7f\u7528<code>git clone<\/code>\u547d\u4ee4\u5373\u53ef\uff0c\u65e0\u987b\u6ce8\u518cgithub\u3002\uff08\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 github \u7f51\u9875\u4e0a\u7684\u6309\u94ae\u4e0b\u8f7d\uff09<br \/>\n\u4f8b\u5982<code>git clone https:\/\/github.com\/ghb123\/CodeCounter<\/code><\/p>\n<h3>1 \u51c6\u5907<\/h3>\n<h4>1.1 \u5b89\u88c5 git<\/h4>\n<p><a href=\"https:\/\/git-scm.com\/downloads\">https:\/\/git-scm.com\/downloads<\/a><br \/>\n\u5927\u5bb6\u81ea\u884c\u4e0b\u8f7d\u5b89\u88c5\uff0c\u914d\u7f6e\u597d\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<h4>1.2 \u914d\u7f6e ssh<\/h4>\n<p>\u6ca1\u6709 ssh \u7684\u9700\u8981\u5148\u81ea\u884c\u89e3\u51b3\uff0c\u4e0b\u8f7d\u5e76\u5b89\u88c5 ssh<br \/>\n\u521b\u5efa ssh \u5bc6\u94a5\uff0c\u90ae\u7bb1\u5730\u5740\u6539\u6210\u4f60\u6ce8\u518c github \u65f6\u7528\u7684\u90ae\u7bb1<br \/>\n<code>ssh-keygen -t rsa -C \"admin@guanhaobo.cn\"<\/code><br \/>\n\u4e00\u8def\u56de\u8f66\u5373\u53ef\uff0c\u4e4b\u540e\u4f1a\u751f\u6210\u6587\u4ef6id_rsa.pub\uff0c\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u8fd9\u4e2a\u6587\u4ef6\uff0c\u590d\u5236\u5168\u90e8\u5185\u5bb9\u3002<br \/>\n\u5728 github \u8bbe\u7f6e\u91cc\u521b\u5efa\u4e00\u4e2a ssh \u5bc6\u94a5\uff0c\u5c06\u521a\u521a\u590d\u5236\u7684\u5bc6\u94a5\u7c98\u8d34\u8fdb\u53bb\u5e76\u4fdd\u5b58\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.guanhaobo.cn\/wp-content\/uploads\/2020\/06\/4002.jpg\" alt=\"\" \/><\/p>\n<p>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u9a8c\u8bc1<br \/>\n<code>ssh -T git@github.com<\/code><\/p>\n<h4>1.3 \u914d\u7f6e git<\/h4>\n<p>\u914d\u7f6e\u9ed8\u8ba4\u7684\u8d26\u53f7\u548c\u90ae\u7bb1\uff0c\u66f4\u6539\u4e3a\u4f60\u81ea\u5df1\u7684 github \u8d26\u53f7\u548c\u90ae\u7bb1\u3002<\/p>\n<pre><code class=\"language-cpp line-numbers\">git config --global user.name \"ghb123\"\ngit config --global user.email \"admin@guanhaobo.cn\"\n<\/code><\/pre>\n<h3>2 \u7b2c\u4e00\u4e2a\u9879\u76ee<\/h3>\n<h4>2.1 \u521b\u5efa\u4ed3\u5e93<\/h4>\n<p>\u5728 github \u4e0a\u70b9\u51fb <code>New repository<\/code>\u65b0\u5efa\u4ed3\u5e93\uff0c\u9009\u62e9\u521b\u5efa<code>README.md<\/code>\u5e76\u9009\u62e9\u4e00\u4e2a\u5f00\u6e90\u534f\u8bae\u3002<\/p>\n<h4>2.2 \u4e0b\u8f7d\u5230\u672c\u5730<\/h4>\n<p>\u4f7f\u7528<code>git clone<\/code>\u4e0b\u8f7d\u4ed3\u5e93\u5230\u672c\u5730\uff0c\u4f8b\u5982<br \/>\n<code>git clone https:\/\/github.com\/ghb123\/CodeCounter<\/code><\/p>\n<h4>2.3 \u6dfb\u52a0\u6587\u4ef6<\/h4>\n<p>\u5728\u672c\u5730\u7684 CodeCounter \u6587\u4ef6\u5939\u91cc\u65b0\u5efa\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\u3002<\/p>\n<pre><code class=\"language-cpp line-numbers\">\/\/ \u8fdb\u5165\u9879\u76ee\u76ee\u5f55\ncd CodeCounter\n\/\/ \u5411\u4ed3\u5e93\u6dfb\u52a0\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\ngit add 1.cpp\ngit add 2.cpp\n\/\/ \u6216\u8005\u76f4\u63a5\u5c06\u6240\u6709\u6587\u4ef6\u90fd\u6dfb\u52a0\ngit add --all\n\/\/ \u4fdd\u5b58\u4fee\u6539\uff0c\u5e76\u6dfb\u52a0\u8bf4\u660e\ngit commit -m \"\u589e\u52a0\u6e90\u4ee3\u7801\"\n<\/code><\/pre>\n<p>\u5982\u679c\u4ee5\u540e\u4fee\u6539\u4e86\u8fd9\u4e9b\u6587\u4ef6\uff0c\u4e5f\u9700\u8981\u5148add\u518dcommit<\/p>\n<h4>2.4 \u66f4\u65b0\u5230 github<\/h4>\n<pre><code class=\"language-cpp line-numbers\">git push origin master\n<\/code><\/pre>\n<p>\u6210\u529f\u4e4b\u540e\u5237\u65b0 github \u5c31\u4f1a\u53d1\u73b0\u5df2\u7ecf\u548c\u672c\u5730\u5b8c\u5168\u76f8\u540c\u4e86\u3002<\/p>\n<h4>2.5 \u7f16\u5199\u8bf4\u660e\u6587\u6863<\/h4>\n<p>\u4fee\u6539<code>README.md<\/code>\uff0c\u4f7f\u7528 markdown \u8bed\u6cd5\uff0c\u8fd9\u91cc\u4e3b\u8981\u662f\u4ecb\u7ecd\u4f60\u8fd9\u4e2a\u9879\u76ee\u7684\u529f\u80fd\u3001\u4f7f\u7528\u8bf4\u660e\u7b49\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>0 \u5f15\u8a00 \u8fd9\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u4e86\u5982\u4f55\u65b0\u5efa\u81ea\u5df1\u7684\u4ed3\u5e93\uff0c\u5e76\u4f7f\u7528git\u547d\u4ee4\u628a\u672c\u5730\u7684\u4ee3\u7801\u4e0a\u4f20\u5230 github \u4e0a\uff0c\u4f46\u5e76\u4e0d\u662f\u975e\u5e38 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[12],"class_list":["post-592","post","type-post","status-publish","format-standard","hentry","category-note","tag-github"],"_links":{"self":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=592"}],"version-history":[{"count":0,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=\/wp\/v2\/posts\/592\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guanhaobo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}