一、安装配置建议
在 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 下符号链接兼容性差 |
二、初始化与 SSH 配置
安装完成后,打开 Git Bash 进行基础环境初始化。这里需要替换为你自己的信息。
# 配置用户名,替换为你的 GitHub 用户名
git config --global user.name "YourGitHubName"
# 配置邮箱,替换为你的 GitHub 注册邮箱
git config --global user.email "[email protected]"










