{"id":21535,"date":"2024-11-19T11:46:02","date_gmt":"2024-11-19T03:46:02","guid":{"rendered":"https:\/\/fwq.ai\/blog\/21535\/"},"modified":"2024-11-19T11:46:02","modified_gmt":"2024-11-19T03:46:02","slug":"git%e5%ad%98%e5%82%a8%e5%ba%93%e6%80%8e%e4%b9%88%e5%88%a0","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/21535\/","title":{"rendered":"git\u5b58\u50a8\u5e93\u600e\u4e48\u5220"},"content":{"rendered":"<blockquote><p>\n  \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6216 github web \u754c\u9762\u5220\u9664 git \u5b58\u50a8\u5e93\u3002\u65b9\u6cd5\u4e00\uff08\u547d\u4ee4\u884c\uff09\uff1a\u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u76ee\u5f55\uff0c\u8fd0\u884c git rm -r &#8211;cached . \u5220\u9664\u672c\u5730\u5b58\u50a8\u5e93\uff0c\u63d0\u4ea4\u66f4\u6539\uff0c\u63a8\u9001\u5230\u8fdc\u7a0b\u5220\u9664\u8fdc\u7a0b\u5b58\u50a8\u5e93\u3002\u65b9\u6cd5\u4e8c\uff08github web \u754c\u9762\uff09\uff1a\u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u9875\u9762\uff0c\u70b9\u51fb\u201c\u8bbe\u7f6e\u201d\uff0c\u5728\u201c\u5371\u9669\u533a\u57df\u201d\u70b9\u51fb\u201c\u5220\u9664\u6b64\u5b58\u50a8\u5e93\u201d\uff0c\u786e\u8ba4\u540e\u8f93\u5165\u5b58\u50a8\u5e93\u540d\u79f0\u5373\u53ef\u5220\u9664\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/30\/2024053023275052975.jpg\" class=\"aligncenter\" title=\"git\u5b58\u50a8\u5e93\u600e\u4e48\u5220\u63d2\u56fe\" alt=\"git\u5b58\u50a8\u5e93\u600e\u4e48\u5220\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5220\u9664 Git \u5b58\u50a8\u5e93<\/strong><\/p>\n<p><strong>\u65b9\u6cd5\u4e00\uff1a\u901a\u8fc7 Git \u547d\u4ee4\u884c<\/strong><\/p>\n<ol>\n<li> <strong>\u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u76ee\u5f55\uff1a<\/strong>\u5728\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u4f7f\u7528 cd \u547d\u4ee4\u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u6240\u5728\u7684\u76ee\u5f55\u3002<\/li>\n<li>\n<p><strong>\u5220\u9664\u5b58\u50a8\u5e93\uff1a<\/strong>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5220\u9664\u672c\u5730\u5b58\u50a8\u5e93\uff1a<\/p>\n<pre>git rm -r --cached .<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u63d0\u4ea4\u66f4\u6539\uff1a<\/strong>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u63d0\u4ea4\u5bf9 . \u76ee\u5f55\u7684\u5220\u9664\uff1a<\/p>\n<pre>git commit -m \"Delete local repository\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p><strong>\u63a8\u9001\u5230\u8fdc\u7a0b\uff1a<\/strong>\u5982\u679c\u8981\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u5220\u9664\u5b58\u50a8\u5e93\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>git push origin --delete<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ol>\n<p><strong>\u65b9\u6cd5\u4e8c\uff1a\u901a\u8fc7 GitHub Web \u754c\u9762<\/strong><\/p>\n<ol>\n<li> <strong>\u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u9875\u9762\uff1a<\/strong>\u5728 GitHub \u7f51\u7ad9\u4e0a\uff0c\u5bfc\u822a\u5230\u60a8\u8981\u5220\u9664\u7684\u5b58\u50a8\u5e93\u9875\u9762\u3002<\/li>\n<li> <strong>\u70b9\u51fb\u201c\u8bbe\u7f6e\u201d\uff1a<\/strong>\u5728\u5b58\u50a8\u5e93\u9875\u9762\u53f3\u4e0a\u89d2\uff0c\u70b9\u51fb\u201c\u8bbe\u7f6e\u201d\u9009\u9879\u3002<\/li>\n<li> <strong>\u5411\u4e0b\u6eda\u52a8\u5230\u201c\u5371\u9669\u533a\u57df\u201d\uff1a<\/strong>\u9875\u9762\u5e95\u90e8\u4f1a\u6709\u4e00\u4e2a\u540d\u4e3a\u201c\u5371\u9669\u533a\u57df\u201d\u7684\u533a\u57df\u3002<\/li>\n<li> <strong>\u70b9\u51fb\u201c\u5220\u9664\u6b64\u5b58\u50a8\u5e93\u201d\uff1a<\/strong>\u70b9\u51fb\u201c\u5220\u9664\u6b64\u5b58\u50a8\u5e93\u201d\u6309\u94ae\u3002<\/li>\n<li> <strong>\u786e\u8ba4\u5220\u9664\uff1a<\/strong>\u8f93\u5165\u5b58\u50a8\u5e93\u540d\u79f0\u5e76\u70b9\u51fb\u201c\u6211\u5df2\u4e86\u89e3\u540e\u679c\uff0c\u5220\u9664\u6b64\u5b58\u50a8\u5e93\u201d\u6309\u94ae\u3002<\/li>\n<\/ol>\n<p><strong>\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<ul>\n<li>\u5220\u9664 Git \u5b58\u50a8\u5e93\u662f\u4e00\u4e2a\u6c38\u4e45\u6027\u7684\u64cd\u4f5c\uff0c\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u3002<\/li>\n<li>\u53ea\u6709\u5b58\u50a8\u5e93\u7684\u6240\u6709\u8005\u6216\u5177\u6709\u9002\u5f53\u6743\u9650\u7684\u7528\u6237\u624d\u80fd\u5220\u9664\u5b58\u50a8\u5e93\u3002<\/li>\n<li>\u5982\u679c\u5b58\u50a8\u5e93\u4e0e\u5176\u4ed6\u9879\u76ee\u94fe\u63a5\u6216\u5b58\u5728\u6d3b\u52a8\u5206\u652f\uff0c\u5219\u65e0\u6cd5\u5220\u9664\u3002<\/li>\n<li>\u5220\u9664\u8fdc\u7a0b\u5b58\u50a8\u5e93\u4e0d\u4f1a\u81ea\u52a8\u5220\u9664\u672c\u5730\u5b58\u50a8\u5e93\u3002\u5982\u679c\u60a8\u8981\u5220\u9664\u672c\u5730\u5b58\u50a8\u5e93\uff0c\u8bf7\u4f7f\u7528\u4e0a\u8ff0\u65b9\u6cd5\u4e00\u7684\u547d\u4ee4\u884c\u65b9\u6cd5\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5b58\u50a8\u5e93\u600e\u4e48\u5220\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>\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6216 github web \u754c\u9762\u5220\u9664 git \u5b58\u50a8\u5e93\u3002\u65b9\u6cd5\u4e00\uff08\u547d\u4ee4\u884c\uff09\uff1a\u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u76ee\u5f55\uff0c\u8fd0\u884c git rm -r &#8211;cached . \u5220\u9664\u672c\u5730\u5b58\u50a8\u5e93\uff0c\u63d0\u4ea4\u66f4\u6539\uff0c\u63a8\u9001\u5230\u8fdc\u7a0b\u5220\u9664\u8fdc\u7a0b\u5b58\u50a8\u5e93\u3002\u65b9\u6cd5\u4e8c\uff08github web \u754c\u9762\uff09\uff1a\u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u9875\u9762\uff0c\u70b9\u51fb\u201c\u8bbe\u7f6e\u201d\uff0c\u5728\u201c\u5371\u9669\u533a\u57df\u201d\u70b9\u51fb\u201c\u5220\u9664\u6b64\u5b58\u50a8\u5e93\u201d\uff0c\u786e\u8ba4\u540e\u8f93\u5165\u5b58\u50a8\u5e93\u540d\u79f0\u5373\u53ef\u5220\u9664\u3002 \u5982\u4f55\u5220\u9664 Git \u5b58\u50a8\u5e93 \u65b9\u6cd5\u4e00\uff1a\u901a\u8fc7 Git \u547d\u4ee4\u884c \u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u76ee\u5f55\uff1a\u5728\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u4f7f\u7528 cd \u547d\u4ee4\u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u6240\u5728\u7684\u76ee\u5f55\u3002 \u5220\u9664\u5b58\u50a8\u5e93\uff1a\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5220\u9664\u672c\u5730\u5b58\u50a8\u5e93\uff1a git rm -r &#8211;cached . \u767b\u5f55\u540e\u590d\u5236 \u63d0\u4ea4\u66f4\u6539\uff1a\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u63d0\u4ea4\u5bf9 . \u76ee\u5f55\u7684\u5220\u9664\uff1a git commit -m &#8220;Delete local repository&#8221; \u767b\u5f55\u540e\u590d\u5236 \u63a8\u9001\u5230\u8fdc\u7a0b\uff1a\u5982\u679c\u8981\u4ece\u8fdc\u7a0b\u4ed3\u5e93\u4e2d\u5220\u9664\u5b58\u50a8\u5e93\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a git push origin &#8211;delete \u767b\u5f55\u540e\u590d\u5236 \u65b9\u6cd5\u4e8c\uff1a\u901a\u8fc7 GitHub Web \u754c\u9762 \u5bfc\u822a\u5230\u5b58\u50a8\u5e93\u9875\u9762\uff1a\u5728 GitHub \u7f51\u7ad9\u4e0a\uff0c\u5bfc\u822a\u5230\u60a8\u8981\u5220\u9664\u7684\u5b58\u50a8\u5e93\u9875\u9762\u3002 \u70b9\u51fb\u201c\u8bbe\u7f6e\u201d\uff1a\u5728\u5b58\u50a8\u5e93\u9875\u9762\u53f3\u4e0a\u89d2\uff0c\u70b9\u51fb\u201c\u8bbe\u7f6e\u201d\u9009\u9879\u3002 \u5411\u4e0b\u6eda\u52a8\u5230\u201c\u5371\u9669\u533a\u57df\u201d\uff1a\u9875\u9762\u5e95\u90e8\u4f1a\u6709\u4e00\u4e2a\u540d\u4e3a\u201c\u5371\u9669\u533a\u57df\u201d\u7684\u533a\u57df\u3002 [&hellip;]<\/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-21535","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21535","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=21535"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/21535\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=21535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=21535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=21535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}