Basic knowledge and configuration of GIT installation and git in Windows system

Time:2021-3-9

1. Install Git

It’s very easy to install git in Windows system. You just need to download git’s installation package, then install the boot and click Install

Git download address: https://git-scm.com/download/win
After downloading the installation package, double-click the EXE installation package and always click next to install. After the installation, a git option will be added in your right-click menu bar. You can right-click on the computer desktop to see two more menus, as shown in the figure below:

在这里插入图片描述

After you click the GIT bash here menu, you can see a terminal window. Enter the command git — version in the terminal. If you can see the GIT version information, it means that the installation is successful, as shown in the figure below:

在这里插入图片描述

2. Create a git warehouse locally, create a local folder text, enter the local folder directory terminal inputgit initInitialize the warehouse. After initialization, you will find that there is an extra. Git file in the folder

在这里插入图片描述

Simple understanding.git

在这里插入图片描述

  • The hooks directory contains hook scripts for the client or server
  • The objects directory stores all the data content
  • The info directory contains a global exclusion file
  • The refs directory stores a pointer to the submitted object of the branch
  • Description is used to display the description of the warehouse
  • The head file indicates which branch is currently checked out
  • The config file contains project specific configuration options

4. View configuration information

Before setting the nickname and mailbox, you can check whether the nickname and mailbox have been configured before
The command to view nicknames is as follows:


git config user.name

The command to view the mailbox is as follows:


git config user.email

在这里插入图片描述

4.1 setting configuration information
If the above command does not return the corresponding nickname and mailbox, it means that you have not configured the nickname and mailbox. Then it needs to be configured
The command references for configuring nicknames are as follows:

git config --global  user.name  "Your nickname"

The command reference for configuring mailbox is as follows:

git config --global  user.email  "Your email"

4.2 modifying configuration information
In the configuration, if the configuration is wrong or you want to modify the configuration later, you can’t modify the nickname by repeatedly executing the above command. The same is true for mailbox modification. If you set the nickname many times, it will prompt you that you cannot configure it repeatedly after the command is executed, or it may not prompt you, but this situation will lead to the problem that a key is configured with multiple values.

Introduce two methods, the first is through the command line, the second is through modifying the configuration file.

4.2.1 Command line modification configuration

Through the command line to modify the way is relatively simple, you can directly execute the following command
The command to modify the nickname reference is as follows:


git config --global --replace-all user.name "your user name"

The command to modify the email address reference is as follows:


git config --global --replace-all user.email"your user email"

4.2.2 Modify configuration file

Windows system is located in the user’s home directory. Assuming that your current user is administrator, the path of the corresponding configuration file should be C:: users\ administrator.gitconfig , you can directly use Notepad to modify the name or email in it.

If the nickname and mailbox have been configured before, after opening the configuration file with Notepad, you can see the following configuration:


[user]
    name = daxia
    email = [email protected]

If there is a duplicate name or email, you can delete it and leave only one. After modification, enter git config – list through git bash to check whether the modification is successful.

summary

Here is the article about installing GIT and git basic knowledge and configuration under Windows system. For more information about windows installation and configuration of GIT, please search previous articles of developer or continue to browse the following related articles. I hope you can support developer more in the future!