Detailed explanation of installation and configuration of Git tutorial
Git installation configuration
We need to install Git before using Git. Git currently supports Linux/Unix, Solaris, Mac and Windows platforms.
Git
The download address of the installation package for each platform is: http://git-scm.com/downloads
The installation of
Git on the Linux platform requires calling the code of curl, zlib, openssl, expat, libiconv and other libraries, so it is necessary Install these dependent tools first.
There is yum
On a system (such as Fedora) or a system with apt-get (such as Debian system), you can use the following command to install:
Linux
The system can be easily installed using its installation package management tool:
Debian/Ubuntu
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 Centos /RedHat installation command is:
$ yum install curl-devel expat-devel gettext-devel \ openssl-devel zlib-devel $ yum -y install git-core $ git --version git version 1.7.1
Installation on Windows platform
It is equally easy to install Git on Windows platform. There is a project called msysGit that provides an installation package. You can download the exe from the GitHub page.
Install the file and run:
Installation package download address: http://msysgit.github.io/
After completing the installation, you can use the command line git tool (already included) ssh client), and there is also a graphical interface for Git
Project management tools.
Find "Git"->"Git Bash" in the start menu, the Git command window will pop up, and you can perform Git operations in this window.
Installation on Mac platform
The easiest way to install Git on Mac platform is to use the graphical Git installation tool. The download address is:
http://sourceforge.net/projects/git-osx-installer/
The installation interface is as follows:
Git configuration
Git provides a tool called git config, which is specially used to configure or read the corresponding working environment variables.
These environment variables determine the specific working methods and behaviors of Git in each link. These variables can be stored in three different places:
/etc/gitconfig file: a configuration that is common to all users in the system. If using git config use --system option, it is this file that is read and written.
~/.gitconfig file: The configuration file in the user directory is only applicable to that user. If using git config use --global option, it is this file that is read and written.
The configuration file in the Git directory of the current project (that is, .git/config in the working directory
file): The configuration here is only valid for the current project. The configuration at each level will overwrite the same configuration at the upper level, so the configuration in .git/config will overwrite /etc/gitconfig
variable with the same name in .
On Windows systems, Git will look for the .gitconfig file in the user's home directory. The home directory is the directory specified by the $HOME variable, usually
C:Documents and Settings$USER.
In addition, Git will also try to find the /etc/gitconfig file, but it depends on the directory where Git was originally installed, and uses this as the root directory to locate it.
User information
Configure personal user name and email address:
$ git config --global user.name "runoob" $ git config --global user.email test@runoob.com
If the --global option is used, the changed configuration file is the one located in your user home directory, and all your future projects The user information configured here will be used by default.
If you want to use another name or email in a specific project, just remove the --global option and reconfigure. The new settings are saved in .git/config of the current project.
in the file.
Text Editor
Set the text editor used by Git by default, usually Vi or Vim. If you have other preferences, such as Emacs, you can reset it: :
$ git config --global core.editor emacs
Diff Analysis Tool
Another commonly used one is which diff analysis tool to use when resolving merge conflicts. For example, if you want to switch to vimdiff:
$ git config --global merge.tool vimdiff
Git can understand kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff
Wait for the output information of the merge tool.
Of course, you can also specify to use tools developed by yourself. Please refer to Chapter 7 for details on how to do this.
View configuration information
To check 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 configurations files (such as /etc/gitconfig and ~/.gitconfig), but ultimately Git
The last one is actually used.
We can also see these configurations in ~/.gitconfig or /etc/gitconfig, as shown below:
vim ~/.gitconfig
The displayed content is as follows:
[http] postBuffer = 2M [user] name = runoob email = test@runoob.com
You can also directly check an environment variable To set, just follow the specific name, like this:
$ git config user.name runoob
以上就是Git 安装配置的资料,更多相关文章请关注PHP中文网(www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Running the H5 project requires the following steps: installing necessary tools such as web server, Node.js, development tools, etc. Build a development environment, create project folders, initialize projects, and write code. Start the development server and run the command using the command line. Preview the project in your browser and enter the development server URL. Publish projects, optimize code, deploy projects, and set up web server configuration.

Under the BeegoORM framework, how to specify the database associated with the model? Many Beego projects require multiple databases to be operated simultaneously. When using Beego...

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

Which libraries in Go are developed by large companies or well-known open source projects? When programming in Go, developers often encounter some common needs, ...

The problem of using RedisStream to implement message queues in Go language is using Go language and Redis...

The H5 page needs to be maintained continuously, because of factors such as code vulnerabilities, browser compatibility, performance optimization, security updates and user experience improvements. Effective maintenance methods include establishing a complete testing system, using version control tools, regularly monitoring page performance, collecting user feedback and formulating maintenance plans.

There are two ways to convert XML to Excel: use built-in Excel features or third-party tools. Third-party tools include XML to Excel converter, XML2Excel, and XML Candy.

Resource management in Go programming: Mysql and Redis connect and release in learning how to correctly manage resources, especially with databases and caches...
