{"id":11,"date":"2022-10-23T23:45:45","date_gmt":"2022-10-23T15:45:45","guid":{"rendered":"http:\/\/localhost\/?p=11"},"modified":"2023-01-19T17:01:18","modified_gmt":"2023-01-19T09:01:18","slug":"3","status":"publish","type":"post","link":"http:\/\/localhost\/index.php\/2022\/10\/23\/3\/","title":{"rendered":"Git\u5feb\u901f\u5165\u95e8"},"content":{"rendered":"
Git\u4ed3\u5e93\u662f\u76ee\u524d\u5f00\u6e90\u8f6f\u4ef6(Open Source Software)\u53d1\u5e03\u7684\u4e00\u79cd\u91cd\u8981\u9014\u5f84\uff0c\u4e5f\u662f\u56e2\u961f\u534f\u4f5c\u7684\u4e00\u79cd\u91cd\u8981\u624b\u6bb5\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u8f7b\u6613\u627e\u5230\u6bcf\u4e00\u6b21\u63d0\u4ea4\u7684\u6587\u4ef6\u4e0d\u540c\u4e4b\u5904\uff0c\u8fd8\u53ef\u4ee5\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u5b9a\u4f4d\u76ee\u6807\u4ee3\u7801\u7b49\u7b49\u3002\u5f53\u7136\uff0c\u628aGitHub\u5f53\u56fe\u5e8a\u7684\u64cd\u4f5c\u4e2a\u4eba\u5e76\u4e0d\u63d0\u5021\u3002
\n\u65e5\u5e38\u64cd\u4f5c\u5305\u62ec\u5efa\u7acb\u4ed3\u5e93\uff0c\u63d0\u4ea4(Commit)\uff0c\u4e0a\u4f20(Push)\uff0c\u514b\u9686(Clone)\uff0c\u63d0\u4ea4PR\uff0c\u63d0\u51faIssue\u4ee5\u53ca\u53d1\u5e03Release\u7b49\u3002<\/p>\n
\u719f\u6089Git\u64cd\u4f5c\uff0c\u65e0\u8bba\u662f\u4f7f\u7528GUI\uff0c\u8fd8\u662f\u901a\u8fc7\u547d\u4ee4\u884c\uff0c\u6548\u679c\u90fd\u662f\u4e00\u6837\u7684\u3002
\n\u8be5\u6587\u6863\u9488\u5bf9\u6beb\u65e0\u547d\u4ee4\u884c\u57fa\u7840\uff0c\u6beb\u65e0Git\u64cd\u4f5c\u7ecf\u9a8c\uff0c\u6216\u8005\u60f3\u8981\u67e5\u9605\u5177\u4f53\u65b9\u6cd5\u7684\u3002
\n\u4f5c\u8005\u672c\u4eba\u662f\u4e60\u60ef\u4e8e\u4f7f\u7528\u547d\u4ee4\u884c\uff0c\u8fd9\u4e2a\u64cd\u4f5c\u5e76\u4e0d\u590d\u6742\u3002\u5b9e\u9645\u4e0a\uff0c\u4ec5\u4ec5\u53ea\u9700\u8981\u8bb0\u4f4f\u51e0\u4e2a\u5e38\u7528\u547d\u4ee4\u4e0e\u7528\u6cd5\uff0c\u5c31\u53ef\u4ee5\u719f\u7ec3\u638c\u63e1\u3002\u672c\u6587\u5c06\u4e3b\u8981\u4ecb\u7ecd\u547d\u4ee4\u884c\u64cd\u4f5c\u3002<\/p>\n
\u9996\u5148\u5230Git\u5b98\u7f51<\/a>\u4e0b\u8f7dGit\u3002\u5f53\u7136\u4e86\uff0c\u5982\u679c\u4ece\u5b98\u7f51\u4e0b\u8f7d\u975e\u5e38\u6162\u7684\u8bdd\uff0c\u53ef\u4ee5\u9009\u62e9\u955c\u50cf\u6e90\uff0c\u6bd4\u5982\u6e05\u534e\u6e90<\/a>\u3002 \u9996\u5148\u9700\u8981\u77e5\u9053\u4ed3\u5e93\u6709\u4e24\u79cd\u5f62\u5f0f\uff0c\u4e00\u79cd\u662f\u672c\u5730\u4ed3\u5e93<\/strong>\uff0c\u8fd8\u6709\u4e00\u79cd\u662f\u8fdc\u7aef\u4ed3\u5e93<\/strong>\u3002 \u9996\u5148\u786e\u5b9a\u76ee\u6807\u6587\u4ef6\u5939\u7684\u4f4d\u7f6e\u3002\u8be5\u6587\u4ef6\u5939\u5c06\u8981\u5b58\u653e\u9700\u8981\u63d0\u4ea4\u7684\u5185\u5bb9\u3002 \u8be5\u8fc7\u7a0b\u5c06\u5728\u76ee\u6807\u6587\u4ef6\u5939\u4e0b\u5efa\u7acb\u540d\u4e3a\u201c.git\u201d\u7684\u9690\u85cf\u6587\u4ef6\u5939\u3002\u81f3\u6b64\u672c\u5730\u4ed3\u5e93\u5373\u5df2\u5efa\u7acb\u5b8c\u6bd5\u3002<\/p>\n \u5728\u57fa\u4e8eGit\u7684\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0<\/strong>\u4e0a\uff0c\u5982GitHub<\/strong>\u3001Gitee<\/strong>\u7b49\uff0c\u8fd9\u91cc\u4ee5GitHub\u4e3a\u4f8b\u3002 \u8fd9\u91cc\u5206\u4e09\u79cd\u60c5\u51b5\uff0c\u5373\uff1a\u53ea\u5efa\u7acb\u4e86\u672c\u5730\u4ed3\u5e93\uff0c\u53ea\u5efa\u7acb\u4e86\u8fdc\u7aef\u4ed3\u5e93\uff0c\u672c\u5730\u4e0e\u8fdc\u7aef\u90fd\u5efa\u7acb\u4e86\u3002 \u5728\u521a\u521a\u6253\u5f00\u7684\u547d\u4ee4\u7a97\u53e3\u4e2d\uff0c\u5206\u522b\u590d\u5236\u4ee5\u4e0b\u4e24\u6761\u547d\u4ee4\uff0c\u4fee\u6539\u4e3a\u4f60\u81ea\u5df1\u7684\u4fe1\u606f\u540e\u6267\u884c\u3002 \u7528\u6237\u540d\u662fGitHub\u7528\u6237\u540d\uff0c\u90ae\u7bb1\u586b\u6ce8\u518c\u65f6\u4f7f\u7528\u7684\u90ae\u7bb1\u3002 \u7136\u540e\u6211\u5efa\u8bae\u6572\u4e09\u6b21\u56de\u8f66\u3002\u5982\u679c\u8be5\u8fc7\u7a0b\u6ca1\u6709\u7ed3\u675f\uff0c\u90a3\u5c31\u518d\u6765\u4e00\u6b21\u3002 \u6216\u8005\u53ef\u4ee5\u76f4\u63a5\u590d\u5236\u7c98\u8d34\u3002Linux\u7528\u6237\u5e94\u8be5\u4e0d\u9700\u8981\u8bb2\u89e3\u3002 \u56de\u5230\u521a\u521a\u8bf4\u7684\u8fd9\u4e2a\u5efa\u7acb\u8054\u7cfb\u3002\u5efa\u7acb\u4e86\u8fdc\u7aef\u4ed3\u5e93\uff0c\u53ef\u4ee5\u7701\u53bb\u5efa\u7acb\u672c\u5730\u4ed3\u5e93\u7684\u9ebb\u70e6\u3002\u5728\u4ed3\u5e93\u9875\u9762\u4e2d\uff0c\u5982\u679c\u6ca1\u6709\u6dfb\u52a0\u6587\u4ef6\uff0c\u662f\u7a7a\u7684\u5e93\uff0c\u9875\u9762\u4e0a\u5c06\u4f1a\u6709\u4e00\u4e9b\u6307\u5bfc\u6027\u7684\u547d\u4ee4\u63d0\u793a\u3002\u5176\u4e2d\u4f1a\u6709\u4e00\u4e2a\u76f4\u63a5\u4f7f\u7528\u5730\u5740\uff0c\u6709\u4ec0\u4e48HTTPS\uff0cSSH\u7684\u6309\u94ae\u3002\u7531\u4e8e\u521a\u521a\u6dfb\u52a0\u4e86SSH\u5bc6\u94a5\uff0c\u53ef\u4ee5\u76f4\u63a5\u70b9\u51fbSSH\u4e4b\u540e\uff0c\u62ff\u5230\u5730\u5740\uff0c\u683c\u5f0f\u662f\uff1agit@github.com:**\uff0c\u8fd9\u4e2a\u5730\u5740\u662f\u53ef\u4ee5\u76f4\u63a5\u70b9\u51fb\u5730\u5740\u540e\u65b9\u7684\u590d\u5236\u6309\u94ae\u76f4\u63a5\u590d\u5236\u4e0b\u6765\u7684\uff0c\u70b9\u51fb\u4e00\u4e0b\u590d\u5236\u3002 \u7136\u540e\u628a\u521a\u521a\u590d\u5236\u7684\u5730\u5740\u7c98\u8d34\u4e0a\u53bb\u3002clone\u548c\u5730\u5740\u4e4b\u95f4\u662f\u6709\u7a7a\u683c\u7684\u3002\u8be5\u547d\u4ee4\u6267\u884c\u5b8c\u540e\uff0c\u8fdc\u7aef\u7684\u4ed3\u5e93\u4f1a\u88ab\u76f4\u63a5\u5b8c\u5168\u514b\u9686\u4e0b\u6765\u3002\u7136\u540e\u6253\u5f00\u751f\u6210\u7684\u6587\u4ef6\u5939\uff0c\u8fd9\u4e2a\u5c31\u662f\u4ed3\u5e93\u6587\u4ef6\u5939\u3002\u8be5\u64cd\u4f5c\u79f0\u4e3a\u514b\u9686\u4ed3\u5e93<\/strong>\u3002 \u6253\u5f00\u4f60\u7684\u4ed3\u5e93\u6587\u4ef6\u5939\uff0c\u7136\u540e\u8c03\u51fa\u547d\u4ee4\u884c\u7a97\u53e3\uff0c\u7136\u540e\u952e\u5165\uff1a<\/p>\n \u8fd9\u8fd8\u6ca1\u5b8c\uff0c\u7136\u540e\u518d\u590d\u5236\u8fdc\u7aef\u4ed3\u5e93\u5730\u5740\uff0c\u7136\u540e\u7c98\u8d34\u5230\u547d\u4ee4\u7a97\u53e3\u4e0a\u5e76\u6267\u884c\u3002\u5730\u5740\u548corigin\u4e4b\u95f4\u662f\u6709\u7a7a\u683c\u7684\u3002 \u9996\u5148\u8bb2\u4e00\u4e0bGit\u63d0\u4ea4\u673a\u5236\u3002Git\u4ed3\u5e93\u91c7\u7528\u7248\u672c\u5dee\u5f02\u7684\u673a\u5236\uff0c\u4f7f\u5f97\u4e24\u6b21\u76f8\u90bb\u7684\u63d0\u4ea4\u4e4b\u95f4\u7684\u5dee\u5f02\u80fd\u591f\u8f7b\u6613\u627e\u5230\u3002\u5b9e\u9645\u4e0a\uff0c\u5728\u4e0a\u4f20\u5230\u8fdc\u7aef\u4ed3\u5e93\u4e4b\u524d\uff0c\u9700\u8981\u8fdb\u884c\u672c\u5730\u63d0\u4ea4<\/strong>\u3002\u672c\u5730\u63d0\u4ea4\u673a\u5236\u4e0e\u5728\u8fdc\u7aef\u76f4\u63a5\u63d0\u4ea4\u7684\u673a\u5236\u7c7b\u4f3c\uff0c\u4f46\u662f\u4e0d\u7406\u89e3\u673a\u5236\u7684\u53ef\u80fd\u4f1a\u8ba4\u4e3a\u672c\u5730\u6267\u884c\u4e86commit\u547d\u4ee4\u540e\u8fdc\u7aef\u5e94\u8be5\u4e5f\u4f1a\u7acb\u5373\u540c\u6b65\u3002 \u7136\u540e\u518d\u6253\u4e00\u4e2a\u7a7a\u683c\u3002\u6211\u76f8\u4fe1\u5728\u8fd9\u4e2a\u4ed3\u5e93\u6587\u4ef6\u5939\u91cc\u7684\u6587\u4ef6\u5e94\u8be5\u90fd\u662f\u8981\u63d0\u4ea4\u4e0a\u4f20\u7684\uff0c\u6240\u4ee5\u53ef\u4ee5\u76f4\u63a5\u5728\u6587\u4ef6\u5939\u4e0b\u628a\u9664\u4e86.git\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5305\u62ec\u6587\u4ef6\u5939\uff0c\u4e00\u8d77\u76f4\u63a5\u62d6\u8fdb\u7ec8\u7aef\uff0c\u7136\u540e\u6572\u56de\u8f66\u6267\u884c\u3002 \u7b2c\u4e00\u6b21\u63d0\u4ea4\u4e00\u822c\u53ef\u4ee5\u5199Initial Commit\uff0c\u4f46\u8fd9\u4e0d\u662f\u7edd\u5bf9\u7684\u3002 \u4f46\u662f\u63a5\u4e0b\u6765\u4f60\u9700\u8981\u4f7f\u7528vim\u7f16\u8f91\u5668\u6765\u7f16\u8f91\u7406\u7531\uff0cvim\u5bf9\u4e8e\u65b0\u624b\u6765\u8bf4\u4e5f\u8bb8\u662f\u5f88\u5413\u4eba\u7684\uff0c\u56e0\u6b64\u5e76\u4e0d\u63a8\u8350\u8fd9\u4e48\u505a\u3002 \u672c\u5730\u63d0\u4ea4\u4e4b\u540e\uff0c\u56e0\u4e3a\u672c\u5730\u4ed3\u5e93\u4e0e\u8fdc\u7aef\u4ed3\u5e93\u4ec5\u4ec5\u53ea\u662f\u6709\u8054\u7cfb\uff0c\u800c\u4e0d\u662f\u5b9e\u65f6\u540c\u6b65\u7684\uff0c\u6240\u4ee5\u9700\u8981\u624b\u5de5\u4e0a\u4f20\u540c\u6b65\uff0c\u5373Push\u64cd\u4f5c\u3002 \u5206\u652f\u540d\u4e00\u822c\u662fmaster\uff0c\u4e5f\u53ef\u4ee5\u662fmain\uff0c\u5982\u679c\u4e0d\u662f\u591a\u5206\u652f\uff0c\u5efa\u8bae\u4f7f\u7528\u8fd9\u4e24\u79cd\u540d\u79f0\uff0c\u4f46\u662f\u4e5f\u5e76\u4e0d\u662f\u5f3a\u884c\u8981\u6c42\uff0c\u56e0\u4e3a\u5206\u652f\u540d\u79f0\u5e76\u4e0d\u662f\u4e00\u5b9a\u9700\u8981\u662f\u8fd9\u4e24\u79cd\u7684\u3002 \u5982\u679c\u4e0d\u662f\u7b2c\u4e00\u6b21\u63d0\u4ea4\uff0cpull\/clone\u540e\u5e94\u5f53\u4f1a\u76f4\u63a5\u81ea\u52a8\u6307\u5b9a\u5206\u652f\u3002\u5728GitHub\u4e0a\u4e00\u5f00\u4ed3\u5e93\u5c31\u521b\u5efa\u4e86Licence\u7b49\u6587\u4ef6\u7684\u4ed3\u5e93\uff0c\u4e00\u822c\u6307\u5b9a\u7684\u662fmain\u5206\u652f\uff0c\u56e0\u6b64\u5982\u679c\u518d\u6b21\u6307\u5b9a\u5206\u652f\uff0c\u4e14\u540d\u79f0\u4e0d\u540c\uff0c\u5f88\u53ef\u80fd\u4f1a\u5bfc\u81f4\u591a\u5206\u652f\u7684\u51fa\u73b0\uff0c\u800c\u5f88\u5bb9\u6613\u5bfc\u81f4\u6df7\u4e71\u3002\u5b9e\u4f8b\u662f\u8fd9\u6837\u7684\uff1a\u524d\u4e0d\u4e45\u6709\u4e00\u4e2a\u79f0\u4f5cMCDoom<\/a>\u7684\u4ed3\u5e93\u9700\u8981PR\uff0c\u6211\u62ff\u5230\u7684\u662f\u5bf9\u5e94fabric1.19\u5206\u652f\u7684\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u662f\u4ed3\u5e93\u4e3b\u8bbe\u5b9a\u4e861.18\u662f\u4e3b\u5206\u652f\uff0c\u8fd9\u5c31\u5bfc\u81f4\u6211\u64cd\u4f5c\u4ed3\u5e93\u7684\u65f6\u5019\u9047\u5230\u56f0\u96be\uff0c\u540e\u6765\u624d\u53d1\u73b0\u662f\u5206\u652f\u7684\u95ee\u9898\u3002 \u8fd9\u91cc\u7684master\u5e76\u4e0d\u662f\u56fa\u5b9a\u7684\uff0c\u8fd9\u4e2a\u53c2\u6570\u56e0\u5206\u652f\u800c\u5b9a\u3002\u6bd4\u5982\u4f60\u5411main\u5206\u652f\u8fdb\u884c\u4e86\u4e00\u6b21\u63d0\u4ea4\uff0c\u90a3\u4e48\u4f60\u5e94\u5f53\u628amaster\u6539\u6210main\u3002 \u8fd9\u4e00\u5757\u9700\u8981\u5206\u51e0\u79cd\u60c5\u51b5\u3002<\/p>\n \u952e\u5165\uff1a<\/p>\n \u540e\uff0c\u6253\u4e00\u4e2a\u7a7a\u683c\uff0c\u7136\u540e\u518d\u628a\u8fd9\u4e2a\u4e0d\u9700\u8981\u7684\u6587\u4ef6\u62d6\u8fdb\u53bb\u3002<\/p>\n \u952e\u5165\uff1a<\/p>\n \u540e\uff0c\u6253\u4e00\u4e2a\u7a7a\u683c\uff0c\u518d\u628a\u8fd9\u4e2a\u6587\u4ef6\u62d6\u8fdb\u53bb\u3002\u7136\u540e\u518d\u6267\u884c\u4e00\u6b21commit(\u63d0\u4ea4)\u64cd\u4f5c\u3002<\/p>\n \u952e\u5165\uff1a<\/p>\n \u540e\uff0c\u518d\u6253\u4e00\u4e2a\u7a7a\u683c\uff0c\u7136\u540e\u952e\u5165\u5220\u9519\u7684\u6587\u4ef6\u540d\uff0c\u53ef\u4ee5\u76f4\u63a5\u6062\u590d\u5230\u521a\u521a\u63d0\u4ea4\u65f6\u7684\u72b6\u6001\u3002<\/p>\n \u5e76\u4e0d\u5efa\u8bae\u56de\u9000\u7248\u672c\uff0c\u56e0\u4e3a\u8fd9\u6837\u5f88\u53ef\u80fd\u4f1a\u51fa\u95ee\u9898\u3002\u5efa\u8bae\u518d\u6b21\u63d0\u4ea4\u8986\u76d6\u3002\u5982\u679c\u771f\u7684\u60f3\u8981\u56de\u9000\u7248\u672c\uff0c\u8bf7\u67e5\u9605\u76f8\u5173\u8d44\u6599\u3002<\/p>\n \u5728\u524d\u9762\uff0c\u5df2\u7ecf\u63d0\u5230\u8fc7\u4e86\u5176\u57fa\u672c\u64cd\u4f5c\u3002
\nWindows\u7248\u5305\u62ecGit Bash\u548cGit GUI\uff0c\u5177\u4f53\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u65e0\u8111\u70b9\u4e0b\u4e00\u6b65\u3002
\nmacOS\u7528\u6237\u53ef\u4ee5\u4e0b\u8f7dXcode\u5f97\u5230Git\u73af\u5883\uff0c\u5982\u679c\u4e0d\u80fd\u63a5\u53d7Xcode\u7684\u4f53\u79ef\uff0c\u53ef\u4ee5\u5b89\u88c5HomeBrew\uff0c\u5728\u8be5\u8fc7\u7a0b\u4e2d\u5373\u53ef\u5f97\u5230Git\u3002\u5e76\u4e0d\u5efa\u8bae\u4e0b\u8f7dGit\u5b89\u88c5\u5305\u6210\u54c1\u3002
\nLinux\u7528\u6237\u7684\u5b89\u88c5\u65b9\u6cd5\uff0c\u5728\u5b98\u65b9\u4e0b\u8f7d\u9875\u9762<\/a>\u6709\u8be6\u7ec6\u8bf4\u660e\u3002<\/p>\n\u5efa\u7acb\u4ed3\u5e93<\/h4>\n
\n\u672c\u5730\u4ed3\u5e93\u662f\u6307\u5728\u672c\u5730\u5efa\u7acb<\/strong>\u7684\uff0c\u6216\u8005\u662f\u901a\u8fc7\u514b\u9686<\/strong>\u5f97\u5230\u7684\u4ed3\u5e93\u3002<\/p>\n\u672c\u5730\u4ed3\u5e93\u7684\u5efa\u7acb\u65b9\u6cd5(\u547d\u4ee4\u884c)<\/h5>\n
\n\u5bf9\u4e8e\u5df2\u7ecf\u5347\u7ea7\u5230\u4e86Win11\u7684\u7528\u6237\uff0c\u53ef\u4ee5\u53f3\u952e\u76ee\u6807\u6587\u4ef6\u5939\uff0c\u5355\u51fb\u201c\u5728Windows Terminal\u4e2d\u6253\u5f00\u201d\u3002\u6216\u8005\u5355\u51fb\u201c\u663e\u793a\u66f4\u591a\u9009\u9879\u201d\u540e\uff0c\u5355\u51fb"Git Bash Here"\u3002\u8fd9\u4e24\u79cd\u65b9\u6cd5\u90fd\u53ef\u4ee5\u8c03\u51fa\u4e00\u4e2a\u547d\u4ee4\u7a97\u53e3\u3002Win10\u7528\u6237\u5219\u53ef\u4ee5\u76f4\u63a5\u53f3\u952e\uff0c\u5728\u53f3\u952e\u83dc\u5355\u5185\u5355\u51fb"Git Bash Here"\u3002
\n\u5bf9\u4e8emacOS\u7528\u6237\uff0c\u53ef\u4ee5\u5b89\u88c5cd to<\/a>\u6765\u5b9e\u73b0\u901a\u8fc7\u53f3\u952e\u83dc\u5355\u6765\u5728\u8be5\u6587\u4ef6\u5939\u4e0b\u8c03\u7528\u7ec8\u7aef\u3002
\n\u5bf9\u4e8eLinux\u7528\u6237\uff0c\u56e0\u4e3a\u4f5c\u8005\u662f\u5c51\u6c34\u679c\u7528\u6237\uff0c\u6240\u4ee5\u4e0d\u662f\u5f88\u4e86\u89e3\u3002\u6211\u76f8\u4fe1\u7528\u7740Linux\u7684\u7528\u6237\u5bf9\u7ec8\u7aef\u7684\u719f\u6089\u7a0b\u5ea6\u80af\u5b9a\u6bd4\u6211\u9ad8\u3002
\n\u5f53\u7136\uff0c\u8fd9\u4e09\u4e2a\u5e73\u53f0\u7684\u7528\u6237\u5b8c\u5168\u53ef\u4ee5\u81ea\u5efa\u547d\u4ee4\u884c\u7a97\u53e3\uff0c\u7136\u540e\u624b\u52a8\u952e\u5165cd\u547d\u4ee4\u8f6c\u5230\u8be5\u6587\u4ef6\u5939\u4e0b\uff0c\u4f46\u662f\u6709\u70b9\u9ebb\u70e6\u3002\u4e0d\u8fc7\u597d\u5728\u6709Tab\u81ea\u52a8\u8865\u5168\uff0c\u64cd\u4f5c\u8d77\u6765\u4f1a\u8f7b\u677e\u8bb8\u591a\u3002
\n\u8fd8\u6709\u4e00\u79cd\u529e\u6cd5\u5c31\u662f\u4f7f\u7528VSCode\u7ec8\u7aef\u3002\u4f5c\u8005\u672c\u4eba\u7528\u7684\u662fmacOS\u7248\u7684\uff0c\u5e76\u4e0d\u4e86\u89e3Windows\u7248\u7684\u673a\u5236\uff0c\u4f46\u662f\u60f3\u5fc5\u5927\u5dee\u4e0d\u5dee\u3002\u5728VSCode\u7684\u5de5\u5177\u680f\u4e2d\u6709\u4e00\u4e2a\u7ec8\u7aef\u4e0b\u62c9\u83dc\u5355\uff0c\u70b9\u51fb\u65b0\u5efa\u7ec8\u7aef\u3002\u5982\u679c\u6ca1\u6709\u5230\u76ee\u6807\u6587\u4ef6\u5939\uff0c\u53ef\u4ee5cd\u5230\u8be5\u6587\u4ef6\u5939\u4e0b\u3002
\n\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\u540e\u6309\u4e0b\u56de\u8f66\u952e\u6267\u884c\uff0c\u4ee5\u521d\u59cb\u5316\u672c\u5730\u4ed3\u5e93\uff1a<\/p>\ngit init<\/code><\/pre>\n
\u8fdc\u7aef\u4ed3\u5e93\u5efa\u7acb\u65b9\u6cd5<\/h5>\n
\n\u5148\u8bbf\u95eeGitHub<\/a>\u3002\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u8d26\u53f7\uff0c\u53ef\u4ee5\u5148\u53bb\u6ce8\u518c\u3002\u767b\u5f55\u540e\uff0c\u5982\u679c\u4f60\u627e\u4e0d\u5230\u600e\u4e48\u521b\u5efa\u4ed3\u5e93\uff0c\u53ef\u4ee5\u70b9\u8fd9\u4e2a<\/a>\u3002\u5f53\u7136\u4e86\uff0c\u6211\u4e0d\u5e0c\u671b\u4f60\u4f1a\u56e0\u4e3a\u8fd9\u6837\u7684\u95ee\u9898\u800c\u82e6\u607c\u3002\u5c0f\u7ec4\u6210\u5458\u5982\u60f3\u628a\u4ed3\u5e93\u653e\u5728\u7ec4\u7ec7<\/a>\u5185\uff0c\u53ef\u4ee5\u8054\u7cfb\u4f5c\u8005\u6216\u8005\u8ff7\u79bb\u6765\u52a0\u5165\u7ec4\u7ec7\u3002
\n\u4ed3\u5e93\u5efa\u7acb\u8fc7\u7a0b\u53ef\u4ee5\u53c2\u8003\u5efa\u7acb\u9875\u9762\u7684\u4fa7\u8fb9\u6ce8\u91ca\u3002
\n\u5728\u4ee5\u4e0a\u6d41\u7a0b\u8d70\u5b8c\u540e\uff0c\u5373\u53ef\u5f97\u5230\u8fdc\u7aef\u4ed3\u5e93<\/strong>\u3002<\/p>\n\u4ee4\u672c\u5730\u4ed3\u5e93\u4e0e\u8fdc\u7aef\u4ed3\u5e93\u5efa\u7acb\u8054\u7cfb<\/h5>\n
\n\u5982\u679c\u4f60\u53ea\u5efa\u7acb\u4e86\u672c\u5730\u7684\u4ed3\u5e93\uff0c\u6211\u5899\u88c2\u5efa\u8bae\u4f60\u540c\u65f6\u5efa\u7acb\u8fdc\u7aef\u7684\u3002\u8fd9\u6837\u53ea\u6709\u540e\u4e24\u7c7b\u60c5\u5f62\u7684\u4e86\u3002
\n\u5728\u5efa\u7acb\u8054\u7cfb\u4e4b\u524d\uff0c\u9700\u8981\u5148\u6307\u5b9a\u7ec8\u7aef\u4f7f\u7528\u7684\u8d26\u6237\u3002\u5982\u679c\u4e0d\u6307\u5b9a\uff0c\u5c06\u4f1a\u5728\u672a\u6765\u6bcf\u4e00\u6b21\u64cd\u4f5c\u8fdc\u7aef\u65f6\uff0c\u90fd\u8be2\u95ee\u4f60\u7684\u8d26\u53f7\u4e0e\u5bc6\u7801\u3002<\/p>\n\u6307\u5b9a\u8d26\u6237\u5e76\u521b\u5efaSSH\u5bc6\u94a5<\/h5>\n
\n\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709Git Bash\u4f1a\u9047\u5230\u7684\u95ee\u9898\u662f\uff0cCtrl+V\u5e76\u4e0d\u662f\u7c98\u8d34\uff0c\u9700\u8981\u6539\u4e3aShift+Insert\u3002<\/p>\ngit config --global user.name "\u8fd9\u91cc\u6539\u6210\u7528\u6237\u540d\uff0c\u5f15\u53f7\u7559\u7740"\ngit config --global user.email "\u8fd9\u91cc\u6539\u6210\u90ae\u7bb1\uff0c\u5f15\u53f7\u7559\u7740"<\/code><\/pre>\n
\n\u63a5\u4e0b\u6765\u6211\u4e0d\u5f97\u4e0d\u8bf4\u4e00\u4e0b\u521b\u5efaSSH\u5bc6\u94a5<\/strong>\u7684\u5fc5\u8981\u6027\u3002GitHub\u529f\u80fd\u4e0a\u6bd4\u56fd\u5185\u7684Gitee\u4e30\u5bcc\uff0c\u66f4\u52a0\u5b9e\u7528\uff0c\u81f3\u5c11\u6211\u76ee\u524d\u8fd8\u662f\u4e0d\u4f1a\u4f7f\u7528Gitee\u7684\u641c\u7d22\u529f\u80fd\uff0cGitHub\u5728\u8fd9\u65b9\u9762\u6bd4Gitee\u5f3a\u4e86\u4e0d\u77e5\u9053\u591a\u5c11\u3002\u4f46\u662f\u76ee\u524d\u56fd\u5185\u7684\u7f51\u7edc\u73af\u5883\u4e0d\u597d\uff0cGitHub\u5728\u56fd\u5185\u89e3\u6790\u4e3a\u65b0\u52a0\u5761\u5fae\u8f6f\u4e91\uff0c\u800c\u8be5\u901a\u9053\u5728\u56fd\u5185\u56e0\u4e3a\u6709\u91cd\u91cd\u963b\u529b\u7684\u4f5c\u7528\uff0c\u5bfc\u81f4\u4e86GitHub\u65e5\u5e38\u62bd\u98ce\u3002\u6709\u65f6\u5019\u4f7f\u7528\u79fb\u52a8\u6570\u636e\u6d41\u91cf\u4e5f\u8bb8\u4f1a\u597d\u5f88\u591a\uff0c\u4f46\u662f\u8fd9\u5e76\u4e0d\u662f\u4e00\u5b9a\u7684\u3002\u4f7f\u7528\u4fee\u6539Hosts\u7684\u65b9\u6cd5\u53ef\u80fd\u4f1a\u5bf9\u8fd9\u79cd\u60c5\u51b5\u6709\u6539\u5584\u3002\u8be6\u60c5\u8bf7\u53c2\u9605github\u76f4\u8fde\u8bbf\u95ee\u65b9\u6cd5\uff0c\u957f\u671f\u66f4\u65b0\u7684github hosts<\/a>\u3002
\n\u4f46\u662f\uff0cGitHub\u7684SSH\u901a\u9053\u5374\u57fa\u672c\u4e0a\u4e0d\u4f1a\u9047\u5230\u8be5\u95ee\u9898\uff0c\u8f83\u4e3a\u7a33\u5b9a\u3002\u4f46\u662f\u8981\u7528SSH\u901a\u9053\uff0c\u9700\u8981\u6709\u8ba4\u8bc1\u7684\u5bc6\u94a5\u3002\u8fd9\u6837\u5c31\u5f88\u6709\u5fc5\u8981\u521b\u5efa\u4e00\u4e2aSSH\u5bc6\u94a5\u4e86\u3002\u4f46\u662f\u8fd9\u4e2a\u901a\u9053\u53ea\u80fd\u7528\u6765\u505a\u57fa\u672c\u7684\u514b\u9686\u548c\u63d0\u4ea4\uff0c\u5e76\u4e0d\u80fd\u5b8c\u5168\u66ff\u4ee3\u6d4f\u89c8\u5668\u3002\u5176\u5b9e\uff0c\u7ec8\u6781\u89e3\u51b3\u65b9\u6848\uff0c\u5c31\u662f\u949e\u80fd\u529b\u3002<\/del>
\n\u5728\u7ec8\u7aef\u4e2d\u7c98\u8d34\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5e76\u4fee\u6539\u4e3a\u4f60\u81ea\u5df1\u7684\u4fe1\u606f\u3002<\/p>\nssh-keygen -t rsa -C "\u8fd9\u91cc\u6539\u6210\u6ce8\u518c\u4f7f\u7528\u7684\u90ae\u7bb1\uff0c\u5f15\u53f7\u7559\u7740"<\/code><\/pre>\n
\n\u63a5\u4e0b\u6765\uff0c\u5728\u4f60\u7684\u4e2a\u4eba\u6587\u4ef6\u5939\u4e0b\u627e\u5230.ssh\u6587\u4ef6\u5939\u3002\u4e2a\u4eba\u6587\u4ef6\u5939\u5728Windows\u4e2d\uff0c\u5c31\u662f\u5728C:\\Users\\\u6587\u4ef6\u5939\u4e0b\u627e\u5230\u4f60\u7684\u7528\u6237\u540d\u5e76\u70b9\u5f00\u540e\u5230\u8fbe\u7684\u6587\u4ef6\u5939\u3002\u5728macOS\u4e2d\uff0c\u6253\u5f00\u4e00\u4e2aFinder\u7a97\u53e3\uff0c\u7136\u540e\u6309Shift+Command+H\u7ec4\u5408\u952e\u5373\u53ef\u5230\u8fbe\u3002\u5728Linux\u4e2d\u5e94\u8be5\u662f\u4e0d\u9700\u8981\u6211\u8bb2\u7684\uff0c\u76f4\u63a5cd\u8fc7\u53bb\uff0ccat\u4e00\u4e0b\u5c31\u884c\u3002\u201c.ssh\u201d\u6587\u4ef6\u5939\u4e00\u822c\u662f\u9690\u85cf\u7684\u3002Windows\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u5728\u5730\u5740\u680f\u4fee\u6539\u5730\u5740\uff0c\u5e76\u76f4\u63a5\u5b9a\u4f4d\u5230\u8be5\u6587\u4ef6\u5939\u4e0b\u3002macOS\u7528\u6237\u5982\u679c\u6ca1\u6709\u6253\u5f00\u663e\u793a\u9690\u85cf\u6587\u4ef6\u529f\u80fd\uff0c\u5219\u53ef\u4ee5\u6309\u4e0bShift+Command+G\uff0c\u7136\u540e\u5728\u82f1\u6587\u8f93\u5165\u6cd5\u4e0b\u952e\u5165\uff1a<\/p>\n~\/.ssh<\/code><\/pre>\n
\n\u5728\u8be5\u6587\u4ef6\u5939\u4e0b\uff0c\u6709\u4e00\u4e2a\u53eb\u505aid_rsa.pub\u7684\u6587\u4ef6\u3002Windows\u7528\u6237\u53ef\u4ee5\u7528\u8bb0\u4e8b\u672c\u6253\u5f00\uff0cmacOS\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u6253\u5f00\uff0cmacOS\u548cLinux\u7528\u6237\u8fd8\u53ef\u4ee5\u7528vim\u7f16\u8f91\u5668\uff0c\u5177\u4f53\u4e0d\u518d\u5c55\u5f00\u3002\u6253\u5f00\u540e\uff0c\u590d\u5236\u6240\u6709\u5185\u5bb9\uff0c\u7136\u540e\u8bbf\u95eeGitHub\uff0c\u70b9\u51fb\u9875\u9762\u53f3\u4e0a\u89d2\u4f60\u7684\u5934\u50cf\uff0c\u7136\u540e\u5728\u4e0b\u62c9\u83dc\u5355\u5185\u627e\u5230Settings\u5e76\u70b9\u5f00\u3002\u8df3\u8f6c\u9875\u9762\u540e\uff0c\u5de6\u4fa7\u6709\u9009\u9879\u5361\u83dc\u5355\uff0c\u627e\u5230SSH and GPG keys<\/strong>\u5e76\u70b9\u51fb\uff0c\u5728\u53f3\u4fa7\u680f\u4e2d\u53ef\u4ee5\u627e\u5230SSH keys\u7684\u9009\u9879\uff0c\u5728\u540c\u4e00\u884c\u7684\u6700\u53f3\u8fb9\uff0c\u6709New SSH key<\/strong>\u7684\u6309\u94ae\u3002\u70b9\u51fb\u540e\uff0c\u8df3\u8f6c\u51fa\u7684\u9875\u9762\u4e2d\u7684Title\u6846\u91cc\u9762\u53ef\u4ee5\u968f\u4fbf\u5199\uff0c\u548fe\u4e5f\u53ef\u4ee5\u3002\u5728\u4e0b\u9762\u7684Key\u91cc\u9762\u7c98\u8d34\u4f60\u521a\u521a\u590d\u5236\u7684\u5185\u5bb9\uff0c\u70b9\u51fbAdd SSH key<\/strong>\u5c31\u5b8c\u6210\u4e86\u3002\u8fd9\u4e2aSSH key\u53ea\u80fd\u5728\u8be5\u673a\u5668\u4e0a\u4f7f\u7528\uff0c\u5982\u679c\u6362\u4e86\u7535\u8111\u662f\u9700\u8981\u91cd\u65b0\u8d70\u6d41\u7a0b\u7684\u3002<\/p>\n\u5982\u679c\u4f60\u53ea\u5efa\u7acb\u4e86\u8fdc\u7aef\u4ed3\u5e93<\/h6>\n
\n\u63a5\u4e0b\u6765\uff0c\u6253\u5f00\u7ec8\u7aef\uff0c\u4f60\u9700\u8981\u786e\u5b9a\u597d\u4f60\u7684\u672c\u5730\u4ed3\u5e93\u7684\u4f4d\u7f6e\uff0c\u5982Windows\u7528\u6237\uff0c\u6bd4\u5982\u8bf4\u60f3\u8981\u628a\u8fd9\u4e2a\u4ed3\u5e93\u653e\u5728\u684c\u9762\u4e0a\uff0c\u90a3\u4e48\u53ef\u4ee5\u5728\u684c\u9762\u4e0a\u53f3\u952e\u6253\u5f00Windows\u7ec8\u7aef\u6216\u8005\u5f00Git Bash\u3002\u5176\u4ed6\u5e73\u53f0\u7528\u6237\u4e5f\u4e00\u6837\u3002\u6253\u5f00\u547d\u4ee4\u7a97\u53e3\u540e\uff0c\u952e\u5165\uff1a<\/p>\ngit clone <\/code><\/pre>\n
\n\u5982\u679c\u5df2\u7ecf\u52a0\u4e86Licence\uff0c\u4ee5\u53ca.gitignore\u4e4b\u7c7b\u7684\u6587\u4ef6\uff0c\u754c\u9762\u4e0a\u5c06\u6709\u4e00\u4e2a\u7eff\u8272\u7684Code\u6309\u94ae\uff0c\u70b9\u51fb\u540e\u9009\u62e9SSH\uff0c\u76f4\u63a5\u590d\u5236\u5730\u5740\uff0c\u63a5\u4e0b\u6765\u7684\u64cd\u4f5c\u4e0e\u521a\u624d\u7684\u76f8\u540c\u3002<\/p>\n\u5982\u679c\u90fd\u5efa\u7acb\u4e86<\/h6>\n
git remote add origin <\/code><\/pre>\n
\n\u81f3\u6b64\uff0c\u672c\u5730\u4ed3\u5e93\u5df2\u7ecf\u548c\u8fdc\u7aef\u4ed3\u5e93\u5efa\u7acb\u4e86\u8054\u7cfb\u3002<\/p>\n\u63d0\u4ea4<\/h4>\n
\n\u9996\u5148\u4f60\u9700\u8981\u628a\u6539\u52a8\u5b8c\u7684\u6587\u4ef6\u90fd\u653e\u7f6e\u5728\u672c\u5730\u4ed3\u5e93\u7684\u5bf9\u5e94\u4f4d\u7f6e\u4e2d\u3002\u8be5\u8fc7\u7a0b\u5b8c\u6bd5\u540e\uff0c\u624d\u80fd\u8fdb\u884c\u672c\u5730\u63d0\u4ea4\uff0c\u8fd9\u9700\u8981\u9700\u8981\u5148\u5c06\u51c6\u5907\u63d0\u4ea4\u7684\u6587\u4ef6\u5b58\u5165\u6682\u5b58\u533a\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u64cd\u4f5c\u7684\u6587\u4ef6\u4e00\u822c\u6bd4\u8f83\u591a\uff0c\u6211\u7684\u5efa\u8bae\u662f\uff0c\u5148\u884c\u952e\u5165\uff1a<\/p>\ngit add <\/code><\/pre>\n
\n\u8fd9\u65f6\u5019\u4f60\u5c31\u9700\u8981\u68c0\u67e5\u662f\u4e0d\u662f\u591a\u653e\u4e86\u4ec0\u4e48\u6587\u4ef6\uff0c\u4e0d\u7136\u7b49\u4f1a\u63d0\u4ea4(commit)\u4e86\u4e4b\u540e\uff0c\u518d\u60f3\u8981\u64a4\u56de\uff0c\u5c31\u5f88\u9ebb\u70e6\u4e86\u3002
\n\u68c0\u67e5\u65e0\u8bef\u540e(\u5f53\u7136\uff0c\u4e0d\u68c0\u67e5\u4e00\u822c\u4e5f\u6ca1\u4ec0\u4e48\u4e8b\u60c5)\uff0c\u5c31\u53ef\u4ee5\u76f4\u63a5\u952e\u5165\uff1a<\/p>\ngit commit -m "\u81ea\u884c\u7ed9\u51fa\u7406\u7531\uff0c\u5f15\u53f7\u7559\u7740"<\/code><\/pre>\n
\n\u5f53\u7136\uff0c\u4f60\u4e5f\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165\uff1a<\/p>\ngit commit<\/code><\/pre>\n
\n\u8bf7\u6ce8\u610f\uff0c\u63d0\u4ea4\u65f6\u7684\u8bf4\u660e\u662f\u6781\u4e3a\u4e25\u8083\u7684\uff0c\u4e0d\u7136\u4e00\u65e6\u522b\u4eba\u63a5\u624b\u4e86\u4ed3\u5e93\uff0c\u53d1\u73b0\u8fd9\u4e48\u4e00\u5806\u4e1c\u897f\uff0c\u60f3\u5fc5\u4e5f\u4e0d\u592a\u597d\u53d7\uff0c\u800c\u4e14\u4f1a\u6781\u5927\u5730\u964d\u4f4e\u5de5\u4f5c\u6548\u7387\u3002
\n\u8fd9\u65f6\uff0c\u672c\u5730\u63d0\u4ea4\u5c31\u5df2\u7ecf\u5b8c\u6210\u4e86\u3002<\/p>\n\u4e0a\u4f20<\/h4>\n
\n\u5982\u679c\u8fd9\u662f\u4f60\u7b2c\u4e00\u6b21\u63d0\u4ea4\uff0c\u4f60\u8fd8\u9700\u8981\u6307\u5b9a\u5206\u652f\uff1a<\/p>\ngit branch -M master<\/code><\/pre>\n
\n\u7b2c\u4e00\u6b21\u63d0\u4ea4\u6307\u7684\u662f\u7531\u7a7a\u4ed3\u5e93\u72b6\u6001\u8f6c\u4e3a\u6709\u5bf9\u8c61\u7684\u8fc7\u7a0b\uff0c\u5982\u6dfb\u52a0Licence\uff0c\u6dfb\u52a0Readme\uff0c\u6216\u8005\u662f\u76f4\u63a5\u628a\u8be5\u6709\u7684\u4e1c\u897f\u90fd\u63d0\u4ea4\u3002\u5982\u679c\u4f60\u7684\u8fdc\u7aef\u4ed3\u5e93\u5df2\u7ecf\u6709\u4e86Licence\u7b49\uff0c\u90a3\u4e48\u8fd9\u5c31\u5df2\u7ecf\u4e0d\u662f\u7b2c\u4e00\u6b21\u63d0\u4ea4\u4e86\uff0c\u5982\u679c\u662f\u8fd9\u6837\u7684\u60c5\u5f62\uff0c\u4e14\u672c\u5730\u63d0\u4ea4\u524d\u7684\u4ed3\u5e93\u5e76\u4e0d\u548c\u8fdc\u7aef\u540c\u6b65\uff0c\u90a3\u4e48\u4f60\u5e94\u5f53\u8fdb\u884c\u4e00\u6b21Pull\u64cd\u4f5c\uff1a<\/p>\ngit pull<\/code><\/pre>\n
\n\u5728\u6b64\u4e4b\u540e\uff0c\u952e\u5165\uff1a<\/p>\ngit push -u origin master<\/code><\/pre>\n
\n\u81f3\u6b64\uff0c\u672c\u5730\u4ed3\u5e93\u5c31\u548c\u8fdc\u7aef\u4ed3\u5e93\u5b9e\u73b0\u4e86\u540c\u6b65\u3002<\/p>\n\u64a4\u9500\u64cd\u4f5c<\/h4>\n
\u5982\u679c\u4e0d\u5c0f\u5fc3\u628a\u4e0d\u9700\u8981\u7684\u4e1c\u897f\u6dfb\u52a0\u8fdb\u4e86\u6682\u5b58\u533a\uff0c\u4f46\u662f\u8fd8\u6ca1\u6709\u63d0\u4ea4\u2026<\/h5>\n
git reset HEAD<\/code><\/pre>\n
\u5982\u679c\u4e0d\u5c0f\u5fc3\u63d0\u4ea4\u4e86\uff0c\u8fd8\u6ca1\u6709push\u2026<\/h5>\n
git rm<\/code><\/pre>\n
\u5982\u679c\u5728\u8fd9\u4e00\u6b65\u5220\u9519\u4e86\u2026<\/h6>\n
git checkout --<\/code><\/pre>\n
\u5982\u679c\u5df2\u7ecfpush\u4e86\u2026<\/h5>\n
\u514b\u9686<\/h4>\n
\n\u5728\u6d4f\u89c8\u5668\u4e0a\uff0c\u4f60\u770b\u5230\u4e86\u67d0\u4e00\u4e2a\u9700\u8981\u8fdb\u884c\u514b\u9686\u64cd\u4f5c\u7684\u4ed3\u5e93\uff0c\u5728\u8be5\u9875\u9762\u4e0a\uff0c\u6709\u4e00\u4e2a\u7eff\u8272\u7684Code\u6309\u94ae\uff0c\u70b9\u51fb\u540e\u9009\u62e9SSH\uff0c\u76f4\u63a5\u590d\u5236\u5730\u5740\u3002\u63a5\u4e0b\u6765\uff0c\u6253\u5f00\u7ec8\u7aef\uff0c\u4f60\u9700\u8981\u786e\u5b9a\u597d\u514b\u9686\u4ed3\u5e93\u9700\u8981\u653e\u7f6e\u7684\u4f4d\u7f6e\uff0c\u5982Windows\u7528\u6237\uff0c\u6bd4\u5982\u8bf4\u60f3\u8981\u628a\u8fd9\u4e2a\u4ed3\u5e93\u653e\u5728\u684c\u9762\u4e0a\uff0c\u90a3\u4e48\u53ef\u4ee5\u5728\u684c\u9762\u4e0a\u53f3\u952e\u6253\u5f00Windows\u7ec8\u7aef\u6216\u8005\u5f00Git Bash\u3002\u5176\u4ed6\u5e73\u53f0\u7528\u6237\u4e5f\u4e00\u6837\u3002\u6253\u5f00\u547d\u4ee4\u7a97\u53e3\u540e\uff0c\u952e\u5165\uff1a<\/p>\ngit clone <\/code><\/pre>\n