设置Git

安装Git

根据您的平台,使用以下命令安装Git:

Linux

看见 spkg_git 获取您的Linux发行版上的安装命令。

Windows(WSL)

我们强烈建议使用Linux发行版的包管理器来安装该包。Git的本机Windows安装也可以运行,但也可能存在陷阱。

MacOS

安装Xcode命令行工具。

有关安装帮助的其他资源包括:

配置Git

假设你的名字 alice 和电子邮件地址 alice@wonderland.com

[alice@localhost ~]$ git config --global user.name "Alice Adventure"
[alice@localhost ~]$ git config --global user.email alice@wonderland.com

这会将设置写入您的Git配置文件 ~/.gitconfig 提供您的姓名和电子邮件地址:

[user]
    name = Alice Adventure
    email = alice@wonderland.com

当然,换掉 Alice Adventurealice@wonderland.com 写上你的真实姓名和电子邮件地址。

这是目前的基本Git配置。有关配置Git的更多提示,请参见 配置提示