{"id":20303,"date":"2024-11-19T14:02:58","date_gmt":"2024-11-19T06:02:58","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20303\/"},"modified":"2024-11-19T14:02:58","modified_gmt":"2024-11-19T06:02:58","slug":"git%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e7%bd%91%e5%9d%80","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20303\/","title":{"rendered":"git\u5982\u4f55\u67e5\u770b\u7f51\u5740"},"content":{"rendered":"<p>git\u662f\u4e00\u4e2a\u6e90\u4ee3\u7801\u7ba1\u7406\u7cfb\u7edf\uff0c\u4ee5\u53ca\u7528\u4e8e\u534f\u540c\u5de5\u4f5c\u548c\u7248\u672c\u63a7\u5236\u7684\u8f6f\u4ef6\u5de5\u5177\u3002\u901a\u8fc7git\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5728\u540c\u4e00\u65f6\u95f4\u6bb5\u5185\u534f\u540c\u5de5\u4f5c\uff0c\u8ffd\u8e2a\u4ee3\u7801\u7684\u66f4\u6539\uff0c\u4fee\u6539\u548c\u64a4\u6d88\u66f4\u6539\uff0c\u4ee5\u53ca\u76d1\u63a7\u4ee3\u7801\u7684\u7248\u672c\u63a7\u5236\u3002\u5728\u4f7f\u7528git\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u67e5\u770b\u67d0\u4e2a\u4ed3\u5e93\u7684\u7f51\u5740\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4ed3\u5e93\u7684\u5171\u4eab\u3001\u514b\u9686\u548c\u8bbf\u95ee\u7b49\u64cd\u4f5c\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528git\u67e5\u770b\u7f51\u5740\u3002<\/p>\n<p>\u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u67e5\u770b<\/p>\n<p>Git\u662f\u4e00\u4e2a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u901a\u8fc7Git\u547d\u4ee4\u884c\u53ef\u4ee5\u5b9e\u73b0\u5728\u672c\u5730\u4ed3\u5e93\u76ee\u5f55\u4e0b\u67e5\u770b\u4ed3\u5e93\u7684\u7f51\u5740\u3002\u4ee5\u4e0b\u662f\u67e5\u770b\u4ed3\u5e93\u7f51\u5740\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>1.\u5728\u672c\u5730\u6253\u5f00Git Bash\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\u3002<\/p>\n<p>2.\u8fdb\u5165\u5230\u4f60\u7684\u672c\u5730\u4ed3\u5e93\u7684\u76ee\u5f55\u4e2d\uff0c\u8be5\u76ee\u5f55\u5fc5\u987b\u662f\u4e00\u4e2aGit\u4ed3\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7cd\u547d\u4ee4\u5207\u6362\u5230\u8be5\u76ee\u5f55\u3002<\/p>\n<p>3.\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u201cgit remote -v\u201d\u547d\u4ee4\uff0c\u8fd9\u6761\u547d\u4ee4\u4f1a\u5217\u51fa\u8be5\u4ed3\u5e93\u7684\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\u3002<\/p>\n<p>4.\u4ece\u8f93\u51fa\u5217\u8868\u4e2d\uff0c\u627e\u5230\u540d\u4e3aorigin\u7684\u5730\u5740\uff0c\u8be5\u5730\u5740\u662f\u8be5\u4ed3\u5e93\u7684\u4e3b\u8981\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u4ed3\u5e93\u7684\u7f51\u5740\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a<\/p>\n<pre>$ cd myproject\n$ git remote -v\norigin    git@github.com:myusername\/myproject.git (fetch)\norigin    git@github.com:myusername\/myproject.git (push)<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4ed3\u5e93\u7684Github\u5730\u5740\u662fgit@github.com:myusername\/myproject.git\u3002\u53ef\u4ee5\u590d\u5236\u8be5\u5730\u5740\u5e76\u7528\u4e8e\u514b\u9686\u6216\u5171\u4eab\u8be5\u4ed3\u5e93\u3002<\/p>\n<p>\u4e8c\u3001\u4f7f\u7528Git\u56fe\u5f62\u754c\u9762\u67e5\u770b<\/p>\n<p>\u9664\u4e86\u4f7f\u7528\u547d\u4ee4\u884c\u67e5\u770b\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528Git\u56fe\u5f62\u754c\u9762\u5de5\u5177\u6765\u67e5\u770b\u4ed3\u5e93\u7684\u7f51\u5740\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528Git\u56fe\u5f62\u754c\u9762\uff08Git GUI\uff09\u67e5\u770b\u4ed3\u5e93\u7f51\u5740\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>1.\u6253\u5f00Git GUI\u5de5\u5177\uff0c\u5728\u4e3b\u754c\u9762\u4e2d\u9009\u62e9\u201cRepository\u201d\u9009\u9879\uff0c\u7136\u540e\u9009\u62e9\u201cRemote\u2026\u201d\u9009\u9879\u3002<\/p>\n<p>2.\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u80fd\u591f\u770b\u5230\u8be5\u4ed3\u5e93\u7684\u6240\u6709\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\u3002\u53ef\u4ee5\u5355\u51fb\u6bcf\u4e2a\u5730\u5740\uff0c\u7136\u540e\u9009\u62e9\u201cProperties\u201d\u9009\u9879\uff0c\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\u53ef\u4ee5\u67e5\u770b\u8be5\u4ed3\u5e93\u7684\u7f51\u5740\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/guohuaidema\/image-repo\/img\/20211009152337.png\" class=\"aligncenter\" title=\"git\u5982\u4f55\u67e5\u770b\u7f51\u5740\u63d2\u56fe\" alt=\"git\u5982\u4f55\u67e5\u770b\u7f51\u5740\u63d2\u56fe\" \/><\/p>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4ed3\u5e93\u7684Github\u5730\u5740\u662fgit@github.com:myusername\/myproject.git\u3002\u53ef\u4ee5\u590d\u5236\u8be5\u5730\u5740\u5e76\u7528\u4e8e\u514b\u9686\u6216\u5171\u4eab\u8be5\u4ed3\u5e93\u3002<\/p>\n<p>\u603b\u7ed3<\/p>\n<p>\u65e0\u8bba\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u8fd8\u662fGit GUI\u5de5\u5177\uff0c\u90fd\u53ef\u4ee5\u67e5\u770bGit\u4ed3\u5e93\u7684\u7f51\u5740\u3002\u4f7f\u7528Git\u547d\u4ee4\u884c\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u770b\u7f51\u5740\uff0c\u540c\u65f6\u4e5f\u53ef\u4ee5\u8fdb\u884c\u5176\u4ed6Git\u76f8\u5173\u7684\u64cd\u4f5c\u3002\u5982\u679c\u4f60\u66f4\u559c\u6b22\u4f7f\u7528\u56fe\u5f62\u754c\u9762\u5de5\u5177\uff0c\u90a3\u4e48Git GUI\u5de5\u5177\u4e5f\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002\u65e0\u8bba\u4f7f\u7528\u54ea\u79cd\u65b9\u6cd5\uff0c\u67e5\u770bGit\u4ed3\u5e93\u7684\u7f51\u5740\u90fd\u662fGit\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u5fc5\u4e0d\u53ef\u5c11\u7684\u4e00\u4e2a\u64cd\u4f5c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fgit\u5982\u4f55\u67e5\u770b\u7f51\u5740\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>git\u662f\u4e00\u4e2a\u6e90\u4ee3\u7801\u7ba1\u7406\u7cfb\u7edf\uff0c\u4ee5\u53ca\u7528\u4e8e\u534f\u540c\u5de5\u4f5c\u548c\u7248\u672c\u63a7\u5236\u7684\u8f6f\u4ef6\u5de5\u5177\u3002\u901a\u8fc7git\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5728\u540c\u4e00\u65f6\u95f4\u6bb5\u5185\u534f\u540c\u5de5\u4f5c\uff0c\u8ffd\u8e2a\u4ee3\u7801\u7684\u66f4\u6539\uff0c\u4fee\u6539\u548c\u64a4\u6d88\u66f4\u6539\uff0c\u4ee5\u53ca\u76d1\u63a7\u4ee3\u7801\u7684\u7248\u672c\u63a7\u5236\u3002\u5728\u4f7f\u7528git\u8fc7\u7a0b\u4e2d\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u67e5\u770b\u67d0\u4e2a\u4ed3\u5e93\u7684\u7f51\u5740\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4ed3\u5e93\u7684\u5171\u4eab\u3001\u514b\u9686\u548c\u8bbf\u95ee\u7b49\u64cd\u4f5c\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528git\u67e5\u770b\u7f51\u5740\u3002 \u4e00\u3001\u4f7f\u7528\u547d\u4ee4\u884c\u67e5\u770b Git\u662f\u4e00\u4e2a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u901a\u8fc7Git\u547d\u4ee4\u884c\u53ef\u4ee5\u5b9e\u73b0\u5728\u672c\u5730\u4ed3\u5e93\u76ee\u5f55\u4e0b\u67e5\u770b\u4ed3\u5e93\u7684\u7f51\u5740\u3002\u4ee5\u4e0b\u662f\u67e5\u770b\u4ed3\u5e93\u7f51\u5740\u7684\u65b9\u6cd5\uff1a 1.\u5728\u672c\u5730\u6253\u5f00Git Bash\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\u3002 2.\u8fdb\u5165\u5230\u4f60\u7684\u672c\u5730\u4ed3\u5e93\u7684\u76ee\u5f55\u4e2d\uff0c\u8be5\u76ee\u5f55\u5fc5\u987b\u662f\u4e00\u4e2aGit\u4ed3\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7cd\u547d\u4ee4\u5207\u6362\u5230\u8be5\u76ee\u5f55\u3002 3.\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u201cgit remote -v\u201d\u547d\u4ee4\uff0c\u8fd9\u6761\u547d\u4ee4\u4f1a\u5217\u51fa\u8be5\u4ed3\u5e93\u7684\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\u3002 4.\u4ece\u8f93\u51fa\u5217\u8868\u4e2d\uff0c\u627e\u5230\u540d\u4e3aorigin\u7684\u5730\u5740\uff0c\u8be5\u5730\u5740\u662f\u8be5\u4ed3\u5e93\u7684\u4e3b\u8981\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u4ed3\u5e93\u7684\u7f51\u5740\u3002 \u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a $ cd myproject $ git remote -v origin git@github.com:myusername\/myproject.git (fetch) origin git@github.com:myusername\/myproject.git (push) \u767b\u5f55\u540e\u590d\u5236 \u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4ed3\u5e93\u7684Github\u5730\u5740\u662fgit@github.com:myusername\/myproject.git\u3002\u53ef\u4ee5\u590d\u5236\u8be5\u5730\u5740\u5e76\u7528\u4e8e\u514b\u9686\u6216\u5171\u4eab\u8be5\u4ed3\u5e93\u3002 \u4e8c\u3001\u4f7f\u7528Git\u56fe\u5f62\u754c\u9762\u67e5\u770b \u9664\u4e86\u4f7f\u7528\u547d\u4ee4\u884c\u67e5\u770b\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528Git\u56fe\u5f62\u754c\u9762\u5de5\u5177\u6765\u67e5\u770b\u4ed3\u5e93\u7684\u7f51\u5740\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528Git\u56fe\u5f62\u754c\u9762\uff08Git GUI\uff09\u67e5\u770b\u4ed3\u5e93\u7f51\u5740\u7684\u65b9\u6cd5\uff1a 1.\u6253\u5f00Git GUI\u5de5\u5177\uff0c\u5728\u4e3b\u754c\u9762\u4e2d\u9009\u62e9\u201cRepository\u201d\u9009\u9879\uff0c\u7136\u540e\u9009\u62e9\u201cRemote\u2026\u201d\u9009\u9879\u3002 2.\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u80fd\u591f\u770b\u5230\u8be5\u4ed3\u5e93\u7684\u6240\u6709\u8fdc\u7a0b\u4ed3\u5e93\u5730\u5740\u3002\u53ef\u4ee5\u5355\u51fb\u6bcf\u4e2a\u5730\u5740\uff0c\u7136\u540e\u9009\u62e9\u201cProperties\u201d\u9009\u9879\uff0c\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\u53ef\u4ee5\u67e5\u770b\u8be5\u4ed3\u5e93\u7684\u7f51\u5740\u3002 \u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a \u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4ed3\u5e93\u7684Github\u5730\u5740\u662fgit@github.com:myusername\/myproject.git\u3002\u53ef\u4ee5\u590d\u5236\u8be5\u5730\u5740\u5e76\u7528\u4e8e\u514b\u9686\u6216\u5171\u4eab\u8be5\u4ed3\u5e93\u3002 \u603b\u7ed3 \u65e0\u8bba\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u8fd8\u662fGit GUI\u5de5\u5177\uff0c\u90fd\u53ef\u4ee5\u67e5\u770bGit\u4ed3\u5e93\u7684\u7f51\u5740\u3002\u4f7f\u7528Git\u547d\u4ee4\u884c\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u770b\u7f51\u5740\uff0c\u540c\u65f6\u4e5f\u53ef\u4ee5\u8fdb\u884c\u5176\u4ed6Git\u76f8\u5173\u7684\u64cd\u4f5c\u3002\u5982\u679c\u4f60\u66f4\u559c\u6b22\u4f7f\u7528\u56fe\u5f62\u754c\u9762\u5de5\u5177\uff0c\u90a3\u4e48Git GUI\u5de5\u5177\u4e5f\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002\u65e0\u8bba\u4f7f\u7528\u54ea\u79cd\u65b9\u6cd5\uff0c\u67e5\u770bGit\u4ed3\u5e93\u7684\u7f51\u5740\u90fd\u662fGit\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u5fc5\u4e0d\u53ef\u5c11\u7684\u4e00\u4e2a\u64cd\u4f5c\u3002 \u4ee5\u4e0a\u5c31\u662fgit\u5982\u4f55\u67e5\u770b\u7f51\u5740\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-20303","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=20303"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20303\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}