Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Git configure user signatures?

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces in detail the "Git configuration user signature way is what", the content is detailed, the steps are clear, the details are handled properly, I hope that this "Git configuration user signature way is what" the article can help you solve doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.

1. Why create a user signature

As the client of the version control system, each client needs to indicate the identity of the operator for all submission operations of the version library. So the client first needs to register for self-identity, that is, to create a user. Git requires that "user name and Email" information is essential.

In other words, before you let Git work again, you must make a minimum configuration to set up the user.name and user.email of the staff involved in the development of the project.

Configure the role of signatures: just distinguish the identity of different developers.

2. Why configure this information in Git

Each time we change, at what point in time, and who made the change, the two pieces of information are bundled with the information of a change. At the same time, when we are doing code review (code review), every time we change, if we bring the user's email address, then the reviewer points out which file and where there is something wrong with you on the platform.

Then the web system controlled by our version of Git will automatically take out the email of the changer and send an email to the person who changed it. So the users name and email in your changed information must be configured.

If you forget to do this configuration when using Git, when you submit changes in Git later, he will have a long list of prompts telling you that you must do the relevant configuration. As follows:

* Please tell me who you are.Run git config-- global user.email "you@example.com" git config-- global user.name "Your Name" to set your account's default identity.Omit-- global to set the identity only in this repository.fatal: unable to auto-detect email address (got 'L@DESKTOP-T2AI2SU. (none)') 3. How to create a user signature

Git has three different ways to create user signatures, resulting in three different scopes of users.

User information for these three creation methods is written to configuration files in three different locations.

All three types of users need to be created using the git config command, but with different options.

The three levels are local, global, and system. The explanation is as follows:

Project level / warehouse level (local):

File location: this file is located in the .git directory under the current repository and the file name is config.

Function: it is effective for a certain Git warehouse. In other words, when we use Git to manage the file system, it is not managed at the entire operating system level.

For example, he built a Git warehouse in a place, which is equivalent to an area under the control of an independent project.

If local is set, the information (user.name,usere.mail) configured by Git will only be valid for the warehouse where you are currently working. If you switch to another Git repository, the local range configuration value is no longer valid.

User level / global level (global):

File location: in the personal user directory of the system disk on your computer, such as: C:\ Users\ L\ .gitconfig. Note that if the configuration information at the user level is not configured, there is no such file, and the configuration will be automatically generated once.

Function: for example, there are ten Git repositories in my computer, and these global-level configurations are valid for all ten repositories, that is, for current users and all local repositories.

So sometimes, in order to improve efficiency, you can use global scope to configure user signatures, so there is no need to log in to a warehouse to do this configuration, so the way of global is very common in the work.

(that is, it authorizes a user to operate all the warehouses in the computer)

System level (system):

File location: the file is in the local Git installation directory, in the...\ etc\ gitconfig file.

Function: it means that as long as users log in to the operating system, they have the right to operate all Git warehouses in the system.

It is valid for all logged-in users of the system, and this scope is not commonly used (basically not).

Tip: the scope of these three user signatures from large to small is: system users, global users and local library users.

Under the premise that a variety of users have been created, a small range of user signatures will cover a large range of user signatures, that is, Git will be operated with a small range of users by default.

After reading this, the article "what is the way Git configures user signatures" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself. If you want to know more about related articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report