安装
Git 是最常用的版本控制工具。安装完成后,建议先配置用户名、邮箱和默认分支名。
Linux 安装
yum install git
Ubuntu / Debian:
sudo apt update
sudo apt install git
macOS 安装
brew install git
也可以安装 Xcode Command Line Tools:
xcode-select --install
Windows 安装
推荐安装 Git for Windows,安装后可以使用 Git Bash。
基础配置
git config --global user.name "your name"
git config --global user.email "your@email.com"
git config --global init.defaultBranch main
验证
git --version
git config --list