git installation and configuration under linux

1. Installation

$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel $ yum -y install git-core $ git --version git version 1.7.1

2. Configuration

  • /etc/gitconfig Files: Configurations that are common to all users on the system. If  the option git config is used  --system , it is this file that is read and written.
  • ~/.gitconfig File: The configuration files in the user directory are only applicable to this user. If  the option git config is used  --global , it is this file that is read and written.
  • Configuration files in the current project's Git directory (that is,  .git/config files in the working directory): The configuration here is only valid for the current project. The configuration of each level will override the same configuration of the upper layer, so  .git/config the configuration in will override  /etc/gitconfig the variable of the same name in the.

If the  --global  option is used, the changed configuration file is the one located in your user's home directory, and all your future projects will use the user information configured here by default.

If you want to use a different name or email in a specific project, just remove the --global option and reconfigure. The new settings are saved in the current project's .git/config file.

E.g:

[root@master ~]# pwd

/root

[root@master ~]# git config --global user.name "maohx"

[root@master ~]# cat .gitconfig 

[user]

name = maohx

[root@master ~]# git config --global user.email [email protected]

[root@master ~]# cat .gitconfig 

[user]

name = maohx

email = [email protected]

[root@master ~]# pqd

-bash: pqd: command not found

[root@master ~]# pwd

/root

[root@master ~]#

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324930626&siteId=291194637