Global configuration and single warehouse configuration of Git user name mailbox (login with different accounts for different projects)

Global configuration and single warehouse configuration of Git user name mailbox (login with different accounts for different projects)

need

Because the work and personal warehouse addresses, user names, and email addresses are different, many times a git account cannot meet the parallel needs of work and personal learning.

The global username and email address are variables of the local git client, configurable and do not change with the git library. gitee and github count contributors (Contributors) by mailbox.

Our purpose is to set a specific account in a specific project!

Global account and current warehouse account

  1. Global account
    The account information set by git config --global user.name and git config --global user.email applies to all warehouses.
    For example:
git config --global user.name "yourname"
git config --global user.email "[email protected]"
  1. The current warehouse account
    can specify a specific user name and email address in a warehouse through git config user.name and git config user.email.
    For example, run under the warehouse folder :
git config user.name "username" 
git config user.email "[email protected]"

This will override the global account and take effect for the current warehouse.
View Account
Through the git config -luser can view global and local account configuration information.

Generally speaking, it is better to configure the global Git account as a personal account. Many open source projects recommend using a personal email address rather than a corporate email address.
The global Git account is usually set as your own personal mailbox, which is used to identify personal work. According to the needs of the project, configure different local warehouse accounts separately . This maximizes the integrity and continuity of individual submission records.

Guess you like

Origin blog.csdn.net/inthat/article/details/132116332