[{"data":1,"prerenderedAt":213},["ShallowReactive",2],{"content:\u002Fposts\u002Ff9cc792":3,"surround:\u002Fposts\u002Ff9cc792":207},{"id":4,"title":5,"body":6,"categories":182,"date":184,"description":185,"donation":186,"draft":187,"extension":188,"image":189,"meta":190,"navigation":186,"path":192,"permalink":192,"published":189,"readingTime":193,"recommend":189,"references":189,"seo":198,"sitemap":199,"stem":200,"tags":201,"type":205,"updated":184,"__hash__":206},"content\u002Fposts\u002F2026\u002Fgit_win.md","如何在 Windows 安装 Git",{"type":7,"value":8,"toc":175},"minimark",[9,13,31,34,37,50,56,64,136,160,163,166,172],[10,11,12],"h2",{"id":12},"获取安装包",[14,15,16,17,24,25,30],"p",{},"在",[18,19,23],"a",{"href":20,"rel":21},"https:\u002F\u002Fgit-scm.com\u002Finstall\u002Fwindows",[22],"nofollow","官网","下载 Windows 的 git 安装包，如果你的网络环境不允许你直接在这里下载，你也可以在",[18,26,29],{"href":27,"rel":28},"https:\u002F\u002Fmirrors.tuna.tsinghua.edu.cn\u002Fgithub-release\u002Fgit-for-windows\u002Fgit\u002FLatestRelease\u002F",[22],"清华源","下载。",[14,32,33],{},"大多数人电脑是 x64 的，选择 Git for Windows\u002Fx64 Setup 或 Git-xx-64-bit.exe 即可。",[10,35,36],{"id":36},"开始安装",[38,39,40,44,47],"ol",{},[41,42,43],"li",{},"点击安装包，进入许可证界面，点击 Next。",[41,45,46],{},"按喜好设置安装路径后点击 Next。",[41,48,49],{},"按需勾选自己需要的服务：",[51,52],"pic",{":height":53,"caption":54,"src":55},"320","选择组件","https:\u002F\u002Fbu.dusays.com\u002F2026\u002F05\u002F15\u002F6a07306802a8e.webp",[14,57,58,59,63],{},"这里我勾选了",[60,61,62],"code",{"code":62},"添加 Git Bash 到 Windows Terminal","，这样就可以在 Windows Terminal 里直接打开 Git Bash 了。",[38,65,67,70,77,88,95,101,107,114,120,126,133],{"start":66},4,[41,68,69],{},"询问是否添加 Git 到开始菜单，默认，点击 Next。",[41,71,72,73,76],{},"选择默认编辑器，按需设置，我选择了",[60,74,75],{"code":75},"Use Visual Studio Code as Git's default editor","。",[41,78,79,80,83,84,87],{},"设置默认分支名，默认是 ",[60,81,82],{"code":82},"master","，建议改为 ",[60,85,86],{"code":86},"main","，和 GitHub 一致，点击 Next。",[41,89,90,91,94],{},"询问你想如何在命令行使用 git，默认是 ",[60,92,93],{"code":93},"Git from the command line and also from 3rd-party software","，点击 Next。",[41,96,97,98,94],{},"设置 HTTPS 传输后端，默认是 ",[60,99,100],{"code":100},"Use the native Windows Secure Channel Library",[41,102,103,104,94],{},"设置换行符，默认是 ",[60,105,106],{"code":106},"Checkout Windows-style, commit Unix-style line endings",[41,108,109,110,113],{},"设置终端模拟器，默认是 ",[60,111,112],{"code":112},"Use MinTTY (the default terminal of MSYS2)","，它对 Git Bash 这套环境的兼容性更自然，点击 Next。",[41,115,116,117,94],{},"选择 git pull 的默认行为，默认是 ",[60,118,119],{"code":119},"Default (fast-forward or merge)",[41,121,122,123,94],{},"配置凭证管理器，默认是 ",[60,124,125],{"code":125},"Git Credential Helper",[41,127,128,129,132],{},"配置额外选项，默认是 ",[60,130,131],{"code":131},"Enable file system caching","，点击 Install 进行安装。",[41,134,135],{},"安装完成，点击 Finish。",[137,138,141,153],"alert",{"icon":139,"title":140},"tabler:bounce-right","验证安装",[14,142,143,148,149,152],{},[144,145],"key",{":win":146,"code":147},"true","R"," 输入 ",[60,150,151],{"code":151},"cmd"," 打开命令行，",[14,154,155,156,159],{},"输入 ",[60,157,158],{"code":158},"git -v","，如果能看到版本信息就说明安装成功了。",[10,161,162],{"id":162},"初始化配置",[14,164,165],{},"为方便后续使用，推荐你设置全局的用户名和邮箱：",[167,168],"copy",{"code":169,"lang":170,"prompt":171},"git config --global user.name \"xx\"","ps1","PS>",[167,173],{"code":174,"lang":170,"prompt":171},"git config --global user.email xx@xx.com",{"title":176,"searchDepth":66,"depth":66,"links":177},"",[178,180,181],{"id":12,"depth":179,"text":12},2,{"id":36,"depth":179,"text":36},{"id":162,"depth":179,"text":162},[183],"技术","2026-05-15 23:00:50","手把手教你在 Windows 上安装 Git，并完成基础初始化配置",true,false,"md",null,{"slots":191},{},"\u002Fposts\u002Ff9cc792",{"text":194,"minutes":195,"time":196,"words":197},"2 min read",1.78,106800,356,{"title":5,"description":185},{"loc":192},"posts\u002F2026\u002Fgit_win",[202,203,204],"git","windows","安装","tech","WzDxhUAMs5n8-41NOsih7q-wWuUfMWcWtqYCpjQ_sDw",[208,189],{"title":209,"path":210,"stem":211,"date":212,"type":205,"children":-1},"如何安装 Windows 的包管理器 scoop 并配置国内镜像","\u002Fposts\u002Fed5b381","posts\u002F2026\u002Fscoop","2026-05-15 20:32:17",1778859259412]