Mac OS X git installation tutorial

Source: Internet
Author: User
Tags bz2

Original link: http://www.cnblogs.com/ccdev/archive/2012/09/12/2682098.html


Download: http://code.google.com/p/git-osx-installer/

Download the latest Pgk file.

Graphical Openingitgui:

Http://code.google.com/p/git-osx-installer also provides a graphical client of git: Openingitgui, can be obtained from here, Openingitgui is very compact, download after decompression is only 16K, Openingitgui do not install, double-click to use, Openingitgui just started, will record the open resource pool.

GitHub using SSH link, you need to set up SSH

1. Check SSH key

CD ~/.ssh

2. Back up existing key (if any)

mkdir Key_backup

MV id_rsa* Key_backup

3. Generate SSH Key

$ ssh-keygen-t rsa-c jonezhang86@gmail.com

Generating public/private RSA key pair.

Enter file in which to save the key (/USERS/JIANGBO/.SSH/ID_RSA):

Enter passphrase (empty for no passphrase):

Enter same Passphrase again:

Your identification has been saved in Yes.

Your public key has been saved in id_rsa.pub.

The key fingerprint is:

Fb:c4:b0:e0:47:fd:be:e0:fb:ea:73:ef:a8:29:d5:22 jonezhang86@gmail.com

The key ' s Randomart image is:

+--[RSA 2048]----+

| |

| |

| |

|       . |

| .     S.. |

| .    Oe=o.. |

| .    +o+.. |

| ..   +.+.. |

| Oob=+o |

+-----------------+

4. Add SSH key to GitHub

Login to GitHub page, account settings->ssh public keys->add another key

Copy the generated key (id_rsa.pub file) contents to the input box, save.

5. Test link

$ ssh git@github.com

The authenticity of host ' github.com (207.97.227.239) ' can ' t be established.

RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.

Are you sure your want to continue connecting (yes/no)? Yes

PTY allocation request failed on channel 0

Hi Jone zhang! You have ' ve successfully authenticated, but GitHub does not provide shell access.

Connection to github.com closed.

The above message indicates that the connection was successful (GitHub does not provide shell login but has connected successfully)

Third, set up personal information

$ git config--global user.name "Jone Zhang"

$ git config--global user.email jonezhang86@gmail.com

Supplementary content:

Mac
There are several ways to install Git on a Mac: The easiest way to do this is to use git OS X Installer. Open the Git-osx-installer page on Google Code and download the latest installation package. Now the latest is Git 1.7.5. Mount the DMG mirror to install Git. If you want to use the Git GUI, run the script in the DMG mirror to install it. It is also very easy to install if you want to use a package management similar to Homebrew or MacPorts.

Homebrew

sudo Install git

MacPorts

sudo port selfupdate
sudoinstall Git-core

(sudo is running the command with root privileges; it is usually required to install software.) If you use sudo, the command line requires you to enter a user password. )

If you want to experience Git more deeply, install it from the source code. First, you need to install the Apple Developer Tools–xcode. can be downloaded in http://developer.apple.com/mac/.
We install Git in the/usr/local directory to ensure that Terminal can be found in $PATH environment variables. Check the/usr/local/bin path (bin represents binary, and the compiled Git is in subdirectories). If no longer, open. Profile added to the end.

Export Path= "/usr/local/bin: $PATH"

After you save the close. profile file, restart the Terminal. Run echo $PATH should see/usr/local/bin in $PATH environment variable.
Now we can start installing Git, and if you're not familiar with the command line, you can install it using the previous method. If there is no problem, let's start.
Download and unzip the Git source code:

$ Curl-o http://kernel.org/pub/software/scm/git/git-1.7.5.tar.bz2
tar xzvf git-1.7.5

Open the directory and compile Git:

CD git-1.7.5
$./configure

 --prefix=/usr/ Local make Install

Complete. Now it's time to delete this directory.

CD ..
rm git-1.7.5
rm git-1.5.1.tar.bz2

You should see that Git has been installed successfully to view the installation location:

which git

Should get/usr/local/bin/git. If correct, it means that the git! has been successfully installed from the source code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.