1. Mac Git configuration file
Now that you've installed Git on your system, you'll want to do a few things to customize your git environment. Only one configuration is required on each computer, and the configuration information is preserved when the program is upgraded. You can modify them again at any time by running commands.
Git comes with a git config tool to help set configuration variables that control the look and behavior of git. These variables are stored in three different locations:
1> /etc/gitconfig
file: Contains a generic configuration for each user on the system and their warehouse. If you use Git config with the--system option, it reads and writes configuration variables from this file.
2> ~/.gitconfig
or ~/.config/git/config
file: only for the current user. You can pass --global
the option to have Git read and write this file.
3> the config file in the Git directory that is currently using the repository (that is, .git/config)
for the repository.
Each level overrides the previous level of configuration, so .git/config
the configuration variable overrides the /etc/gitconfig
configuration variable in.
2. Windows Git configuration file
- In a Windows system, Git looks
$HOME
for files under the directory (typically C:\Users\$USER
) .gitconfi
. Git also looks for /etc/gitconfig
files, but is limited to the root directory of MSys, which is the target location chosen when installing Git.
3. Configure User Information
The first thing you should do when you install Git is to set up your user name and email address. This is important because each Git commit will use that information and it will be written to each of your commits and cannot be changed.
Note that when using the git command, phrases with spaces are generally wrapped in double quotation marks (or single quotes). You can use it without a space, or you can not use it.
$ git config --global user.name "Qian Chia"$ git config --global user.email "[email protected]"
If you use the --global
option, the command only needs to run once, because Git will use that information no matter what you do on that system. When you want to use a different user name and email address for a particular project, you can configure it by running a command with no options in that project directory --global
.
4. Check configuration information
If you want to check your configuration, you can use the following command to list all the configurations that Git can find at that time.
$ git config --list
$ git config -l
You can git config [key]
check a Git configuration by typing
$ git config user.name$ git config user.email
5. Get Git Help
If you need help with Git, there are three ways to find the user manual for Git commands.
$ git help [verb]$ git [verb] --help$ man git-[verb]
For example, to obtain a manual for the config command, execute.
$ git help config
These commands are great because you can use them anytime, anywhere, without networking. If you feel that the content is not enough, you can try the Freenode IRC server (irc.freenode.ne) #git or #github channel for help. These channels are often hundreds of people online, they are proficient in Git and are ready to help others.
Ios-git configuration (Distributed version control system)