{"id":33,"date":"2023-02-14T13:32:19","date_gmt":"2023-02-14T05:32:19","guid":{"rendered":"http:\/\/aqrboyblog.top\/?p=33"},"modified":"2026-02-01T16:49:06","modified_gmt":"2026-02-01T08:49:06","slug":"win10-git%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/www.aqrboyblog.top\/?p=33","title":{"rendered":"win10 Git\u5b89\u88c5"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">1.\u94fe\u63a5<\/h3>\n\n\n\n<p>\u4e0b\u8f7d\u94fe\u63a5 <a href=\"https:\/\/git-scm.com\/download\">https:\/\/git-scm.com\/download<\/a> \u672c\u5730\u5b89\u88c5\u4f7f\u7528\u9ed8\u8ba4\u9009\u9879\u4e00\u76f4\u4e0b\u4e00\u6b65\u5373\u53ef<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.\u914d\u7f6eGIt<\/h3>\n\n\n\n<p>Git\u63d0\u4f9b\u4e86config\u547d\u4ee4\u6765\u5e2e\u52a9\u8bbe\u7f6e\u914d\u7f6e\u4fe1\u606f\uff0c\u5728\u547d\u4ee4\u884c\u8f93\u5165\uff1a-global \u5168\u5c40\u8fdb\u884c\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git config --global user.name \"\u4f60\u7684\u7528\u6237\u540d\"\ngit config --global user.email \"\u4f60\u7684\u90ae\u7bb1\"<\/code><\/pre>\n\n\n\n<p>Git\u63d0\u4f9b\u4e86config\u547d\u4ee4\u6765\u5e2e\u52a9\u8bbe\u7f6e\u914d\u7f6e\u4fe1\u606f\uff0c\u5728\u547d\u4ee4\u884c\u8f93\u5165\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git config --global --list<\/code><\/pre>\n\n\n\n<p>\u547d\u4ee4\u6267\u884c\u7ed3\u675f\u540e\u53ef\u7528\u547d\u4ee4\u67e5\u770b\u914d\u7f6e\u662f\u5426OK<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.Git \u521b\u5efa\u4ed3\u5e93<\/h3>\n\n\n\n<p>Git \u4f7f\u7528&nbsp;<strong>git init<\/strong>&nbsp;\u547d\u4ee4\u6765\u521d\u59cb\u5316\u4e00\u4e2a Git \u4ed3\u5e93\uff0cGit \u7684\u5f88\u591a\u547d\u4ee4\u90fd\u9700\u8981\u5728 Git \u7684\u4ed3\u5e93\u4e2d\u8fd0\u884c\uff0c\u6240\u4ee5&nbsp;<strong>git init<\/strong>&nbsp;\u662f\u4f7f\u7528 Git \u7684\u7b2c\u4e00\u4e2a\u547d\u4ee4\u3002\u4e5f\u53ef\u4ee5\u7ed9\u6307\u5b9a\u7a7a\u6587\u4ef6\u5939\u521d\u59cb\u5316<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git init\ngit init newrepo\ngit add . #\u6240\u6709\u6587\u4ef6\ngit add -f \u6587\u4ef6\u540d #\u6307\u5b9a\u6587\u4ef6\u5939\ngit commit -m \"\u6ce8\u91ca\"<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>git init &#8211; \u521d\u59cb\u5316\u4ed3\u5e93\u3002<\/li>\n\n\n\n<li>git add . &#8211; \u6dfb\u52a0\u6587\u4ef6\u5230\u6682\u5b58\u533a\u3002<\/li>\n\n\n\n<li>git commit &#8211; \u5c06\u6682\u5b58\u533a\u5185\u5bb9\u6dfb\u52a0\u5230\u4ed3\u5e93\u4e2d\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u6211\u4eec\u4f7f\u7528&nbsp;<strong>git clone<\/strong>&nbsp;\u4ece\u73b0\u6709 Git \u4ed3\u5e93\u4e2d\u62f7\u8d1d\u9879\u76ee\uff08\u7c7b\u4f3c&nbsp;<strong>svn checkout<\/strong>\uff09\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u514b\u9686\u4ed3\u5e93\u7684\u547d\u4ee4\u683c\u5f0f\u4e3a\uff1a<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone &lt;repo&gt;\ngit clone &lt;repo&gt; &lt;directory&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u67e5\u770b\/\u5207\u6362\/\u521b\u5efa\u5206\u652f<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>git branch -a \u672c\u5730 \u8fdc\u7a0b \u5206\u652f\ngit checkout \u5206\u652f\u540d\ngit checkout -b \u5206\u652f\u540d\ngit reset --hard<\/code><\/pre>\n\n\n\n<p><strong>\u53c2\u6570\u8bf4\u660e\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>repo:<\/strong>Git \u4ed3\u5e93\u3002<\/li>\n\n\n\n<li><strong>directory:<\/strong>\u672c\u5730\u76ee\u5f55\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u7f16\u8f91 git \u914d\u7f6e\u6587\u4ef6:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>git config -e    # \u9488\u5bf9\u5f53\u524d\u4ed3\u5e93 \ngit config -e --global   # \u9488\u5bf9\u7cfb\u7edf\u4e0a\u6240\u6709\u4ed3\u5e93<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bbe\u7f6e\u63d0\u4ea4\u4ee3\u7801\u65f6\u7684\u7528\u6237\u4fe1\u606f\uff1a<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>git config --global user.name \"username\"\ngit config --global user.email demo@username.com<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u6dfb\u52a0\u8fdc\u7a0b\u7248\u672c\u5e93\uff1a<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>git remote add &#91;shortname] &#91;url]<\/code><\/pre>\n\n\n\n<p>shortname \u4e3a\u672c\u5730\u7684\u7248\u672c\u5e93\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> git remote add origin git@github.com:tianqixin\/runoob-git-test.git<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>git pull<\/strong>&nbsp;\u547d\u4ee4\u7528\u4e8e\u4ece\u8fdc\u7a0b\u83b7\u53d6\u4ee3\u7801\u5e76\u5408\u5e76\u672c\u5730\u7684\u7248\u672c\u3002<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>git pull &lt;\u8fdc\u7a0b\u4e3b\u673a\u540d&gt; &lt;\u8fdc\u7a0b\u5206\u652f\u540d&gt;:&lt;\u672c\u5730\u5206\u652f\u540d&gt;\ngit pull origin master\ngit remote -v  # \u67e5\u770b\u4fe1\u606f<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>git push<\/strong>&nbsp;\u547d\u4ee4\u7528\u4e8e\u4ece\u5c06\u672c\u5730\u7684\u5206\u652f\u7248\u672c\u4e0a\u4f20\u5230\u8fdc\u7a0b\u5e76\u5408\u5e76\u3002<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>git push &lt;\u8fdc\u7a0b\u4e3b\u673a\u540d> &lt;\u672c\u5730\u5206\u652f\u540d>:&lt;\u8fdc\u7a0b\u5206\u652f\u540d>\ngit push origin master\n\ngit reset --hard \u6307\u5b9a\u5206\u652f\u56de\u6eda<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u89e3\u51b3\u6bcf\u6b21git pull\u3001git push\u90fd\u9700\u8981\u8f93\u5165\u8d26\u53f7\u548c\u5bc6\u7801<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>git config --global credential.helper store\ngit pull\n\u8f93\u51fa:\nUsername for 'https:\/\/git.xxxxxxxx.com': ******\nPassword for 'https:\/\/demo123@163.com': *******<\/code><\/pre>\n\n\n\n<p>git config [\u9009\u9879]<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u914d\u7f6e\u6587\u4ef6\u4f4d\u7f6e\n    --global              \u4f7f\u7528\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\n    --system              \u4f7f\u7528\u7cfb\u7edf\u7ea7\u914d\u7f6e\u6587\u4ef6\n    --local               \u4f7f\u7528\u7248\u672c\u5e93\u7ea7\u914d\u7f6e\u6587\u4ef6\n    -f, --file &lt;\u6587\u4ef6&gt;     \u4f7f\u7528\u6307\u5b9a\u7684\u914d\u7f6e\u6587\u4ef6\n    --blob &lt;blob-id&gt;      read config from given blob object\n\n\u64cd\u4f5c\n    --get                 \u83b7\u53d6\u503c\uff1aname &#91;value-regex]\n    --get-all             \u83b7\u5f97\u6240\u6709\u7684\u503c\uff1akey &#91;value-regex]\n    --get-regexp          \u6839\u636e\u6b63\u5219\u8868\u8fbe\u5f0f\u83b7\u5f97\u503c\uff1aname-regex &#91;value-regex]\n    --replace-all         \u66ff\u6362\u6240\u6709\u5339\u914d\u7684\u53d8\u91cf\uff1aname value &#91;value_regex]\n    --add                 \u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u53d8\u91cf\uff1aname value\n    --unset               \u5220\u9664\u4e00\u4e2a\u53d8\u91cf\uff1aname &#91;value-regex]\n    --unset-all           \u5220\u9664\u6240\u6709\u5339\u914d\u9879\uff1aname &#91;value-regex]\n    --rename-section      \u91cd\u547d\u540d\u5c0f\u8282\uff1aold-name new-name\n    --remove-section      \u5220\u9664\u4e00\u4e2a\u5c0f\u8282\uff1aname\n    -l, --list            \u5217\u51fa\u6240\u6709\n    -e, --edit            \u6253\u5f00\u4e00\u4e2a\u7f16\u8f91\u5668\n    --get-color &lt;slot&gt;    \u627e\u5230\u914d\u7f6e\u7684\u989c\u8272\uff1a&#91;\u9ed8\u8ba4]\n    --get-colorbool &lt;slot&gt;\n                          \u627e\u5230\u989c\u8272\u8bbe\u7f6e\uff1a&#91;stdout-is-tty]\n\n\u7c7b\u578b\n    --bool                \u503c\u662f \"true\" \u6216 \"false\"\n    --int                 \u503c\u662f\u5341\u8fdb\u5236\u6570\n    --bool-or-int         \u503c\u662f --bool or --int\n    --path                \u503c\u662f\u4e00\u4e2a\u8def\u5f84\uff08\u6587\u4ef6\u6216\u76ee\u5f55\u540d\uff09\n\n\u5176\u5b83\n    -z, --null            \u7ec8\u6b62\u503c\u662fNUL\u5b57\u8282\n    --includes            \u67e5\u8be2\u65f6\u53c2\u7167 include \u6307\u4ee4\u9012\u5f52\u67e5\u627e\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p class=\"text-justify\">1.\u94fe\u63a5 \u4e0b\u8f7d\u94fe\u63a5 https:\/\/git- [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66,65],"tags":[],"class_list":["post-33","post","type-post","status-publish","format-standard","hentry","category-win","category-65"],"_links":{"self":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":7,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":334,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions\/334"}],"wp:attachment":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}