1. Before downloading Git, let's first understand what is git, why we need to download git, and what are the characteristics of git.
Git is a distributed version control system. To put it bluntly, it is a code management tool for managing and backing up changes to files, directories, projects, etc., to facilitate viewing history and restoring previous versions of software.
Features of git:
a. There is no "central server" in the git distributed version control system. Each computer has a complete version library of Local Repository, which is equivalent to each computer being a server.
b. Local git version control can do anything without relying on the network, and has better support for branching and merging.
Note: Networking is only required when pushing to a remote warehouse.
2. Choose to install Git on the Windows system for this installation
1. Select the latest version on the Git official website to directly download the installation program
URL: https://git-scm.com/
2. Select the corresponding version to download.
3. After the software download is complete, it looks like this.
4. Double-click the software, open it and click Next.
5. Click Next again (the installation path here can be set)
6. If you want to add the icon to the desktop, you can check it (I choose to check it here)), then use other default options, and click Next.
7. Here it is prompted whether to create a git folder in the start menu bar, and click Next by default.
7. Here I choose the default editor of vim by default, or you can choose notepad++, vscode, etc. according to your needs.
8. To configure PATH, choose the second option here.
Use Git from Git Bash only: This is the safest option because your PATH will not be modified at all and you can only use Git command line tools from Git Bash.
Use Git from the Windows Command Prompt: This option is considered safe and 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. It is recommended to select this option.
Use Git and optional Unix tools from the Windows Command Prompt: Both Git and optional Unix tools will be added to your computer's PATH. WARNING: This will override Windows tools such as "find" and "sort", use this option only after understanding its implications.
9. Use the default options and click Next.
10. Use the default options and click Next.
11. Use the default options and click Next.
12. Use the default options, click Install to install, and click Finish after the installation is complete.
13. Click Git Bash in Git in the start menu bar, and the command line window below will pop up, indicating that Git is installed successfully.
14. Finally, you can enter cmd during operation through Win+R and enter git --version in the command prompt window to view the current installed version.
3. Account configuration after installation. After
installing Git, the first thing you need to do is to set the user name and email address. Because Git is a distributed version control system, each machine must report itself: your user Name and Email address, because each Git commit will use this information.
1. Open the menu bar and select Git, click Git Bash to open the settings window or directly click the shortcut icon on the desktop.
2. Enter the user name and Email
and enter the following command line to set.
$ git config --global user.name "username"
$ git config --global user.email "email"
Here is some configuration syntax:
git config --global user.name "set username"
git config --global user.email set email
git config user.name view user name
git config user.email check email
git config --global user.name "Modify user name"
git config --global user.email modify mailbox
At this point, the Git installation and settings are complete, and then you can use the functions of the git warehouse on this machine to manage files as much as you want.