Before using Git, you must install it and make some basic configuration changes. Here are the steps to install the Git client on Ubuntu and CentOS Linux.
Git client Installation
If you are using the Gnu/linux distribution, the Debian Basic Apt-get command will take care of everything.
[Ubuntu ~]$ sudo apt-get install git-core [sudo] password for ubuntu:
[Ubuntu ~]$ git–version git version 1.8.1.2
Also, if you are using the Gnu/linux release version based on RPM, use the Yum command, as follows:
[CentOS ~]$ Su–password:
[CentOS ~]# yum-y Install Git-core
[CentOS ~]# git–version git version 1.7.1
Customizing the GIT Environment
GIT provides a configuration tool for Git that allows you to set configuration variables. Git will put all the global configuration. gitconfig files in the home directory. To set these as global configuration values, add the-global option, and if you omit the-global option, then the configuration is the specific current Git repository.
You can also set system-wide configurations. Git stores these values in the/etc/gitconfig file, which contains every user and resource library on the configuration system. To set these values, you must have root privileges and use the-system option.
When the code above compiles and executes, it produces the following results:
Set User name
This information is used for each commit of git.
[[email protected] project]$ git config–global user.name "Jerry Mouse"
Set e-mail id
This information is used for each commit of git.
[email protected] project]$ git config–global user.email "[email protected]"
Avoid pulling submit merge
From the latest changes in the remote repository, if these changes are different, Git creates a merge submission by default. We can avoid this with the following settings.
[email protected] project]$ git config–global branch.autosetuprebase always
Color highlighting
The following command makes the color highlight in the console of Git.
[[email protected] project]$ git Config–global color.ui true
[[email protected] project]$ git config–global color.status auto
[[email protected] project]$ git config–global color.branch auto
Set the default editor
By default, Git uses the system by default from the editor of the visual or editor environment variables. We can set a different configuration using Git.
[[email protected] project]$ git config–global core.editor vim
Set the default Merge tool
Git does not provide a default merge tool to incorporate changes to the work tree conflict. We can set the default merge tool by enabling the following settings.
[[email protected] project]$ git config–global merge.tool vimdiff
List git settings
In order to verify your git settings local repository use Git's config-List command, as shown below.
[[email protected] ~]$ git config–list
The above command produces the following results.
User.name=jerry Mouse [email protected] push.default=nothing branch.autosetuprebase=always color.ui=true color.status =auto Color.branch=auto Core.editor=vim Merge.tool=vimdiff
PS: If you want to communicate with the industry technology Daniel, please add QQ Group (521249302) or pay attention to the public number (askharries), thank you!
Git environment settings (install)