{"id":789,"date":"2023-08-02T11:11:25","date_gmt":"2023-08-02T03:11:25","guid":{"rendered":"http:\/\/fanaticboy.com\/?p=789"},"modified":"2023-08-02T11:11:26","modified_gmt":"2023-08-02T03:11:26","slug":"git%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/fanaticboy.com\/?p=789","title":{"rendered":"Git\u57fa\u672c\u64cd\u4f5c"},"content":{"rendered":"\n<p>\u4e00\u3001\u672c\u5730\u521b\u5efa\u4ed3\u5e93<\/p>\n\n\n\n<p>1\u3001\u5728\u8981\u4f5c\u4e3a\u5de5\u7a0b\u7684\u6587\u4ef6\u5939\u6253\u5f00\u547d\u4ee4\u884c\u7ec8\u7aef\uff08\u5982Git Bash\u3001Terminal\u7b49\uff09\u6216\u8005\u4f7f\u7528\u56fe\u5f62\u754c\u9762\u7684Git\u5ba2\u6237\u7aef\uff08\u5982GitHub Desktop\uff09\u3002<\/p>\n\n\n\n<p>2\u3001\u6dfb\u52a0\u5168\u5c40\u59d3\u540d\u548c\u90ae\u7bb1\u4f5c\u4e3a\u6807\u8bc6\u4f5c\u8005\uff0c\u4e3a\u63a8\u9001\u505a\u51c6\u5907<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u4e0b\u9762\u5f15\u53f7\u91cc\u9762\u7684\u5185\u5bb9\u6362\u6210\u81ea\u5df1\u7684\u5c31\u53ef\u4ee5\ngit config --global user.name \"Your Name\"\r\ngit config --global user.email \"youremail@example.com\"\r<\/code><\/pre>\n\n\n\n<p>3\u3001\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521d\u59cb\u5316\u4e00\u4e2a\u65b0\u7684Git\u4ed3\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git init<\/code><\/pre>\n\n\n\n<p>4\u3001\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u4f60\u5c06\u770b\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u8f93\u51fa<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Initialized empty Git repository in \/path\/to\/repository\/.git\/\r<\/code><\/pre>\n\n\n\n<p>5\u3001\u6dfb\u52a0\u6587\u4ef6\u5230\u4ed3\u5e93\u4e2d\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u8fd9\u4e2a\u65f6\u6dfb\u52a0\u5168\u90e8\u6587\u4ef6\ngit add .\n# \u6dfb\u52a0\u67d0\u4e00\u6587\u4ef6\ngit add \u6587\u4ef6\u540d\r<\/code><\/pre>\n\n\n\n<p>6\u3001\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u63d0\u4ea4\u6587\u4ef6\u7684\u66f4\u6539\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u6b64\u5904\u5907\u6ce8\u662f\u4e00\u5b9a\u8981\u5199\u7684\ngit commit -m \"\u5907\u6ce8\"\r\n<\/code><\/pre>\n\n\n\n<p>\u4e8c\u3001\u4e0a\u4f20\u8fdc\u7a0b\u4ed3\u5e93<\/p>\n\n\n\n<p>1\u3001\u521b\u5efa\u8fdc\u7a0b\u4ed3\u5e93<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u767b\u5f55\u5230\u4f60\u4f7f\u7528\u7684\u8fdc\u7a0b\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff08\u5982GitHub\u3001GitLab\u7b49\uff09\u3002<\/li>\n\n\n\n<li>\u5728\u5e73\u53f0\u4e0a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7a7a\u4ed3\u5e93\u3002\u8fd9\u901a\u5e38\u5728\u4eea\u8868\u677f\u6216\u4ed3\u5e93\u5217\u8868\u9875\u9762\u4e0a\u6709\u76f8\u5e94\u7684\u9009\u9879\u3002<\/li>\n<\/ul>\n\n\n\n<p>2\u3001\u5173\u8054\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># origin\u662f\u8d77\u7684\u540d\u5b57\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u7684\uff0cremote-url\u8fd9\u4e2a\u662f\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\ngit remote add origin &lt;remote-url>\r<\/code><\/pre>\n\n\n\n<p>3\u3001\u62c9\u53d6\u8fdc\u7a0b\u4ed3\u5e93\uff08\u53ef\u9009\uff09<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u7684\u8fdc\u7a0b\u4ed3\u5e93\u5df2\u7ecf\u6709\u4e00\u4e9b\u63d0\u4ea4\uff08\u53ef\u80fd\u662fREADME\u6587\u4ef6\u6216\u5176\u4ed6\u521d\u59cb\u6587\u4ef6\uff09\uff0c\u4e3a\u4e86\u907f\u514d\u51b2\u7a81\uff0c\u5efa\u8bae\u5728\u5f00\u59cb\u63a8\u9001\u4e4b\u524d\u5148\u62c9\u53d6\u8fdc\u7a0b\u4ed3\u5e93\u7684\u5185\u5bb9\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git pull origin master\r<\/code><\/pre>\n\n\n\n<p>4\u3001\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b8c\u6210\u4e86\u672c\u5730\u4ed3\u5e93\u7684\u63d0\u4ea4\uff08\u4f7f\u7528<code>git add<\/code>\u548c<code>git commit<\/code>\uff09\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u672c\u5730\u4ed3\u5e93\u7684\u66f4\u6539\u63a8\u9001\u5230\u8fdc\u7a0b\u4ed3\u5e93\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>git push origin master\r<\/code><\/pre>\n\n\n\n<p>5\u3001\u8f93\u5165\u8fdc\u7a0b\u4ed3\u5e93\u7684\u767b\u5f55\u51ed\u636e\uff08\u5982\u679c\u6709\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5982\u679c\u4f7f\u7528\u7684\u662fHTTPS\u534f\u8bae\uff0c\u7cfb\u7edf\u53ef\u80fd\u4f1a\u8981\u6c42\u4f60\u8f93\u5165\u8fdc\u7a0b\u4ed3\u5e93\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u4f7f\u7528SSH\u534f\u8bae\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u63d0\u4f9bSSH\u5bc6\u94a5\u7684\u5bc6\u7801\uff08\u5982\u679c\u8bbe\u7f6e\u4e86\u5bc6\u94a5\u5bc6\u7801\uff09\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u672c\u5730\u521b\u5efa\u4ed3\u5e93 1\u3001\u5728\u8981\u4f5c\u4e3a\u5de5\u7a0b\u7684\u6587\u4ef6\u5939\u6253\u5f00\u547d\u4ee4\u884c\u7ec8\u7aef\uff08\u5982Git Bash\u3001Terminal\u7b49\uff09\u6216\u8005\u4f7f\u7528\u56fe\u5f62 &#8230; <a title=\"Git\u57fa\u672c\u64cd\u4f5c\" class=\"read-more\" href=\"https:\/\/fanaticboy.com\/?p=789\" aria-label=\"\u9605\u8bfb Git\u57fa\u672c\u64cd\u4f5c\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[],"class_list":["post-789","post","type-post","status-publish","format-standard","hentry","category-git"],"_links":{"self":[{"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/posts\/789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=789"}],"version-history":[{"count":1,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=\/wp\/v2\/posts\/789\/revisions\/790"}],"wp:attachment":[{"href":"https:\/\/fanaticboy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fanaticboy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}