Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Git on Mac platform

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to install Git on the Mac platform, the article is very detailed, has a certain reference value, interested friends must read it!

Installation on Mac platform

The easiest way to install Git on the Mac platform is to use the graphical Git installation tool, which can be downloaded from:

Http://sourceforge.net/projects/git-osx-installer/

The installation interface is as follows:

Git configuration

Git provides a tool called git config to configure or read the corresponding work environment variables.

These environmental variables determine the specific working mode and behavior of Git in each link. These variables can be stored in three different places:

/ etc/gitconfig file: a configuration that is universally applicable to all users in the system. If you use the-- system option when using git config, this is the file you are reading and writing.

~ / .gitconfig file: the configuration file in the user directory applies only to that user. If you use the-- global option when using git config, this is the file you are reading and writing.

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 valid only for the current project. Each level of configuration overrides the same configuration at the upper level, so the configuration in .git / config overrides 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, which is usually C:\ Documents and Settings\ $USER.

In addition, Git will try to find the / etc/gitconfig file, just to see what directory Git was installed in, and use it as the root directory to locate.

User information

Configure an individual's 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's home directory, 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 settings are saved in the .git / config file of the current project.

Text editor

Set the text editor that Git uses by default, which may be Vi or Vim. If you have other preferences, such as Emacs, you can reset::

$git config-global core.editor emacs

Difference analysis tool

Another thing that is more commonly used is which difference analysis tool is used to resolve merge conflicts. For example, if you want to switch to vimdiff:

$git config-global merge.tool vimdiff

Git can understand the output of merge tools such as kdiff3,tkdiff,meld,xxdiff,emerge,vimdiff,gvimdiff,ecmerge and opendiff.

Of course, you can also specify how to use your own tools, which can be found in Chapter 7.

View configuration information

To check the existing configuration information, use the git config-- list command:

$git config-listhttp.postbuffer=2Muser.name=runoobuser.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 in the end Git actually takes the last one.

These configurations can also be seen in ~ / .gitconfig or / etc/gitconfig, as shown below:

Vim / .gitconfig

The display is as follows:

[http] postBuffer = 2m [user] name = runoob email = test@runoob.com

You can also directly refer to the settings of an environment variable, as long as you follow a specific name, like this:

The above $git config user.namerunoob is all the contents of the article "how to install Git on the Mac platform". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report