1. Download the latest version of the Git installation package from the official website
Official website download link: Git - Downloading Package
Select the version to download according to your computer system
2. Installation
1. Run the installer
After running the downloaded Git installation program, the following installation interface pops up, click Next
2. Select the installation location and click Next
3. Enter the installation configuration interface, select the configuration you need, and click Next after the selection is complete.
Note: The configuration items are described as follows:
(建议勾选)Additional icons
On the Desktop 在桌面上添加图标
(建议勾选)Windows Explorer integration 在Windows资源管理器集成鼠标右键菜单
Git Bash Here
Git GUI Here Git
(建议勾选)Git LFS (Large File Support) 大文件支持
(建议勾选)Associate .git* configuration files with the default text editor 将 .git 配置文件与默认文本编辑器相关联
(建议勾选)Associate .sh files to be run with Bash 将.sh文件关联到Bash运行
(按需勾选)Check daily for Git for Windows updates 每天检查Git是否有Windows更新
(建议勾选)(NEW!)Add a Git Bash Profile to Windows Terminal 将Git Bash的配置文件添加在Windows终端中的配置文件中(这是2.34.1版本新增的功能,省去了自己额外单独添加)
4. Select the start menu folder here, and click Next directly
5. Select the default editor window of Git, just click Next
6. Adjust the name of the initial branch in the new repository
- Let Git Decide
Git decides by itself, the current default is master - Override the default branch name for new repositories
Fill in the default branch by yourself, commonly used are "main", "truck", "development" - You can choose the initial name according to your preferences, and then click Next
7. Generate a list that works for you
(1) Use Git from Git Bash only
This is the safest option as your PATH will not be modified at all. You can only use the Git command line tool with Git Bash.
(2) Use Git from the Windows Command Prompt
This option is considered safe because it only adds some minimal Git packages to PATH to avoid confusing the environment with optional Unix tools. You will be able to use Git from Git Bash and Windows Command Prompt.
(3) Use Git and optional Unix tools from the Windows Command Prompt
to use Git and optional Unix tools from the Windows Command Prompt
Git and optional Unix tools will be added to your computer's PATH
8. Select the SSH executable file, select the open SSH, and then click Next.
9. Select the HTTPS transport backend
(1) Use the OpenSSL library
The
server certificate will be verified using the ca-bundle.crt file
(2) Use the native Windows Secure Channel library
The
server certificate will be verified using the Windows certificate store. This option also allows you to use your company's internal root CA certificate, e.g. via Active Directory Domain Services
10. Configure line ending interpreter
(1) Checkout Windows-style, commit Unix-style line endings
When checking out a text file, Git will convert LF to CRLF. When submitting text files, CRLF will be converted to LF. For cross-platform projects, this is the recommended setting on Windows ("core.autocrlf" is set to "true")
(2) Checkout as-is, commit Unix-style line endings
When checking out text files, Git will not perform any convert. CRLF will be converted to LF when submitting text files. For cross-platform projects, this is the recommended setting on Unix (“core.autocrlf” is set to “input”)
(3) Checkout as-is, commit as-is
When checking out or committing text files, Git will not perform any convert. This option is deprecated for cross-platform projects ("core.autocrlf" is set to "false")
11. Configure the terminal emulator
(1) Use MinTTY (the default terminal of MSYS2)
Git Bash will use MinTTY as a terminal emulator with resizable windows, non-rectangular selections, and Unicode fonts. Windows console programs (such as interactive Python) must be started via 'winpty' to run in MinTTY.
(2) Use Windows' default console window
Git will use Windows' default console window ("cmd.exe"), which can be used with Win32 console programs (such as interactive Python or node.js), but the default The scrollback is very limited, needs to be configured to use a unicode font to display non-ASCII characters correctly, and prior to Windows 10, its window cannot be freely resized and only allows rectangular text selection.
12. Choose the default behavior of Giy Pull
Default: fast forward or merge
Rebase: Rebase
Only ever fast-forward: only fast forward
13. Select the credential helper and select the default
14. Configure additional features, just select the default
15. Additional experimental configuration options, it is recommended not to check
16. Installation
3. Whether the verification is successful
Press the keyboard key win+R
to bring up the run box, enter cmd
the command prompt, enter git --version
If the corresponding version information number appears as shown in the figure below, it proves that Git has been successfully installed