一、Git下载
首先去官网下载Git
如果想下载老版本Git,点击Downloads->Older releases
我下载的是Git-2.43.0-64-bit.exe
二、安装
1、双击Git-2.43.0-64-bit.exe进入安装界面,next
2、自定义安装路径,next
这部选择好后,后面可以一直next
3、选择组件,默认,next
4、选择开始菜单文件夹,默认,next
5、选择git的默认编辑方式,默认为vim,next
6、项目初始化的主干名称,next
7、调整Path环境变量,next
Use Git from Git Bash only
This is the most cautious choice as your PATH will not be modified at all. You w only be able to use the Git command line tools from Git Bash.
仅从 Git Bash 使用 Git
这是最谨慎的选择,因为您的 PATH 根本不会被修改。您将只能使用 Git Bash 中的 Git 命令行工具。
Git from the command line and also from 3rd-party software
(Recommended) This option adds only some minimal Git wrappers to your PATH to avoid cluttering your environment with optional Unix tools.
You will be able to use Git from Git Bash, the Command Prompt and the Windov PowerShell as well as any third-party software looking for Git in PATH.
从命令行以及第三方软件进行 Git
(推荐)此选项仅将一些最小的 Git 包装器添加到PATH中,以避免使用可选的 Unix 工具使环境混乱。
您将能够使用 Git Bash 中的 Git,命令提示符和 Windov PowerShell 以及在 PATH 中寻找 Git 的任何第三方软件。
Use Git and optional Unix tools from the Command Prompt
Both Git and the optional Unix tools will be added to your PATH.
Warning: This will override Windows tools like "find"and "sort". Only use this option if you understand the implications.
使用命令提示符中的 Git 和可选的 Unix 工具
Git 和可选的 Unix 工具都将添加到您的 PATH 中。
警告:这将覆盖 Windows 工具,例如 "find" and "sort". 仅在了解其含义后使用此选项。
8、选择SSH可执行文件,next
9、选择https后端传输,next
10、配置行尾转换,next
Checkout windows-style, commit Unix-style line endings
签出 Windows 样式,提交 Unix 样式的行结尾:签出文本文件时,Git会将LF转换为CRLF。提交文本文件时,CRLF将转换为LF。对于跨平台项目,这是Windows上的推荐设置(“ core.autocrlf”设置为“ true”)。
Checkout as-is, commit Unix-style line endings
按原样签出,提交Unix样式的行结尾:签出文本文件时,Git不会执行任何转换。 提交文本文件时,CRLF将转换为LF。对于跨平台项目,这是Linux/Mac OS上的建议设置(“ core.autocrlf”设置为“ input”)。
Checkout as-is, commit as-is
按原样签出,按原样提交:当签出或提交文本文件时,Git不会执行任何转换。不建议跨平台项目选择此选项(“ core.autocrlf”设置为“ false”)。
11、配置终端窗口和Git Bash一起使用,next
12、选择默认的git pull行为,next
13、选择凭证助手,next
14、配置额外选项,next
15、配置实验性选项,点击install安装
容易产生bug,不建议选
16、安装完成,点击finish
17、检查是否安装成功
win+R->cmd->git -v
三、配置用户名和邮箱
首次安装必须配置,因为通过git进行项目管理时可以记录是谁做的,但是和github或gitlab本身账号无关
设置命令
git config --global user.name "用户名" git config --global user.email "邮箱"
查看命令
git config user.name git config user.email