Git installation Configuration
We need to install git before using Git. Git currently supports running on Linux/unix, Solaris, Mac, and Windows platforms.
Git each platform installs the package to download the address: http://git-scm.com/downloads
Install on Linux platform
Git needs to invoke the code of Curl,zlib,openssl,expat,libiconv and so on, so you need to install these dependencies first.
On systems with Yum (such as Fedora) or on apt-get systems (such as the Debian system), you can install them with the following command:
Linux systems can be easily installed using their installation package management tools:
Debian/ubuntu
The Debian/ubuntu Git installation command is:
$ apt-get Install Libcurl4-gnutls-dev Libexpat1-dev gettext \
libz-dev libssl-dev
$ apt-get Install Git-core
$ git--version
git version 1.8.1.2
Centos/redhat
If the system you are using is the Centos/redhat installation command for:
$ yum Install curl-devel expat-devel gettext-devel \
openssl-devel zlib-devel
$ yum-y Install git-core
$ git --version
git version 1.7.1
Installed on Windows platform
Installing Git on the Windows platform is also easy, with a project called Msysgit that provides installation packages that can be downloaded to the GitHub page and run:
installation package Download Address: http://msysgit.github.io/
Once the installation is complete, you can use the command line git tool (already with the SSH client), and a graphical interface git project management tool.
Find "git"-> "git Bash" in the Start Menu, which pops up the git command window, where you can perform a git operation.
Install on MAC platform
The easiest to install Git on the MAC platform is to use the graphical git installation tool, download the address:
http://sourceforge.net/projects/git-osx-installer/
The installation interface looks like this:
Git Configuration
GIT provides a tool called Git config that is designed to configure or read the corresponding work environment variables.
These environment variables determine the specific ways and behavior of Git in every aspect of the work. These variables can be stored in the following three different places:
- /etc/gitconfig file: A configuration that is universally applicable to all users in the system. If you use Git config with the--system option, this is the file that you read and write.
- ~/.gitconfig file: The configuration file in the user directory applies only to that user. If you use Git config with the--global option, this is the file that you read and write.
- The configuration file in the Git directory of the current project (that is, the. git/config file in the working directory): The configuration here is only valid for the current project. Each level of configuration overwrites the same configuration at the top, so the configuration in the. Git/config overwrites the variable with the same name in/etc/gitconfig.
On Windows systems, Git looks for the. gitconfig file in the user's home directory. The home directory is the directory specified by the $HOME variable, typically the C:\Documents and Settings\ $USER.
In addition, Git will try to find/etc/gitconfig files, just look at the original Git installed in the directory, as the root directory to locate.
User Information
To configure a personal user name and e-mail address:
$ git config--global user.name "Runoob"
$ git config--global user.email test@runoob.com
If you use the--global option, the changed profile is located in the directory of your head of household, and all your projects will use the user information configured here by default.
If you want to use a different name or email in a particular project, just remove the--global option and reconfigure it, and the new setting is saved in the. git/config file for the current project.
Text Editor
Set up a text editor that Git uses by default, which is typically either Vi or Vim. If you have other preferences, such as Emacs, you can reset:
$ git config--global core.editor emacs
Variance analysis Tools
There is also a more common use of the differential analysis tool when resolving merge conflicts. For example, to switch to Vimdiff:
$ git config--global merge.tool vimdiff
Git can understand the output information of Kdiff3,tkdiff,meld,xxdiff,emerge,vimdiff,gvimdiff,ecmerge, and Opendiff and other merge tools.
Of course, you can also specify how to use your own development tools, specifically how to do can refer to chapter seventh.
View configuration information
To check for existing configuration information, you can use the git config--list command:
$ git config--list
http.postbuffer=2m
user.name=runoob
user.email=test@runoob.com
Sometimes you see duplicate variable names, which means they come from different configuration files (such as/etc/gitconfig and ~/.gitconfig), but ultimately Git actually uses the last one.
These configurations can also be seen in ~/.gitconfig or/etc/gitconfig, as follows:
Vim ~/.gitconfig
The display reads as follows:
[HTTP]
Postbuffer = 2M
[user]
name = Runoob
email = test@runoob.com
You can also refer directly to the setting of an environment variable, as long as you follow a specific name in the following way:
$ git config user.name
Runoob
The above is git installation configuration of information, follow-up to continue to collate relevant information, thank you for your support of this site!