一、安装配置
在 Windows 系统上安装 Git 时,建议根据以下选项进行设置,以确保后续开发流程顺畅。
| 组件选择 | 保留默认勾选,取消 Check daily for updates | 自动更新没必要,核心功能够用 |
| 默认编辑器 | 选 Use Visual Studio Code as Git's default editor | 避免 Vim 学习成本,和开发工具统一 |
| 初始分支名 | 选 Override,分支名填 main | 适配 GitHub/Gitee 主流规范 |
| PATH 配置 | 选 Git from the command line and also from 3rd-party software | 多终端可用(Git Bash/CMD/VSCode) |
| SSH 客户端 | 选 Use bundled OpenSSH | 自带工具兼容性更好,无需额外安装 |
| HTTPS 后端 | 选 Use the native Windows Secure Channel library | 系统原生适配,无需手动管理证书 |
| 换行符处理 | 选 Checkout Windows-style, commit Unix-style | 跨平台协作不冲突 |
| 终端模拟器 | 选 Use MinTTY | 界面更友好,支持窗口缩放 |
git pull 行为 | 选 Fast-forward or merge | 保留提交历史,适合个人/团队开发 |
| 凭证管理器 | 选 Git Credential Manager | 自动保存账号密码,免重复输入 |
| 额外选项 | 保留 Enable file system caching,取消 Enable symbolic links | 提升性能,Windows 下符号链接兼容性差 |
二、安装后配置
启动 Git Bash 后,首先初始化全局用户信息。这一步是为了标识你的提交记录,所有本地仓库都会应用此配置。
git config --global user.name "YourGitHubName"
git config --global user.email "[email protected]"

执行 git config --list 可查看当前配置。若输出中包含刚才设置的 user.name 和 user.email,说明配置已生效。
生成 SSH 密钥
为了免密访问代码仓库,需要生成 RSA 密钥对。在 Git Bash 中输入:
ssh-keygen -t rsa -C







