Mac OS X git installation tutorial

Source: Internet
Author: User

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

Download the latest PGK file.

Graphical openingitgui:

Bytes.

When using SSH links on GitHub, you need to set up SSH

1. Check the SSH key

Cd ~ /. SSH

2. Back up the existing key (if any)

Mkdir key_backup

MV id_rsa * key_backup

3. generate an SSH key

$ Ssh-keygen-t rsa-C jiang.bo.hit@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 jiang.bo.hit@gmail.com

The key's randomart image is:

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

|

|

|

|. |

|. S... |

|. OE = o... |

|. + O +... |

|... +... |

| OOB = + O |

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

4. Add the SSH key to GitHub

Log on to the GitHub page, account settings-> SSH public keys-> Add another key

Copy the generated key (id_rsa.pub file) to the input box and save it.

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 you want to continue connecting (Yes/No )? Yes

Pty allocation request failed on channel 0

Hi Jiang-bo! You 've successfully authenticated, but GitHub does not provide shell access.

Connection to github.com closed.

The above prompt indicates that the connection is successful (GitHub does not provide shell login but the connection is successful)

3. Set personal information

$ Git config -- global user. Name "Jone Zhang"

$ Git config -- global user. Email jonezhang86@gmail.com

 

Additional content:

Mac
There are multiple ways to install git on Mac: the simplest method is to use git OS X installer. Open the git-OSX-installer page on Google Code and download the latest installation package. The latest version is GIT 1.7.5. Mount the DMG image to install git.

    • If you want to use git GUI, run the script in the DMG image to install it.
    • If you want to use package management similar to Homebrew or macports for installation, it is also very simple.

Homebrew

 
$SudoBrewInstall Git

Macports

 

 
$SudoPort selfupdate $SudoPortInstallGit-core

(SUDO is a command that has the root user permission to run; it is usually required to install software. If sudo is used, the command line requires the user password .)

If you want to experience git more deeplySource codeInstall it. First, install Apple Developer Tools-xcode. Can be downloaded in the http://developer.apple.com/mac.
Install git in the/usr/local directory to ensure that terminal can be found in the $ PATH environment variable. Check the/usr/local/bin path (bin indicates binary, And the compiled git report is included in the subdirectory ). If no longer, open. Profile and add it to the end.

Export Path="/USR/Local/Bin:$ Path"

After saving the close. profile file, restart terminal. Run echo $ path and check that/usr/local/bin is in the $ PATH environment variable.
Now we can start to install git. If you are not familiar with the command line, you can install it using the previous method. If there is no problem, start.
Download and decompress the GIT SourceCode:

$ Curl-OHTTP://Kernel.org/Pub/Software/SCM/Git/Git-1.7.5.tar.bz2 $TarXzvf git-1.7.5

Open the Directory and compile git:

$CDGit-1.7.5 $./Configure-- Prefix=/USR/Local$Make$Make Install

Done! Now you can delete this directory.

 
$CD... $RmGit-1.7.5 $RmGit-1.5.1.tar.bz2

You should see that git has been successfully installed. Check the installation location:

$Which Git

/Usr/local/bin/git should be obtained. If it is correct, it indicates that git has been successfully installed from the source code!

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

Download the latest PGK file.

Graphical openingitgui:

Bytes.

When using SSH links on GitHub, you need to set up SSH

1. Check the SSH key

Cd ~ /. SSH

2. Back up the existing key (if any)

Mkdir key_backup

MV id_rsa * key_backup

3. generate an SSH key

$ Ssh-keygen-t rsa-C jiang.bo.hit@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 jiang.bo.hit@gmail.com

The key's randomart image is:

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

|

|

|

|. |

|. S... |

|. OE = o... |

|. + O +... |

|... +... |

| OOB = + O |

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

4. Add the SSH key to GitHub

Log on to the GitHub page, account settings-> SSH public keys-> Add another key

Copy the generated key (id_rsa.pub file) to the input box and save it.

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 you want to continue connecting (Yes/No )? Yes

Pty allocation request failed on channel 0

Hi Jiang-bo! You 've successfully authenticated, but GitHub does not provide shell access.

Connection to github.com closed.

The above prompt indicates that the connection is successful (GitHub does not provide shell login but the connection is successful)

3. Set personal information

$ Git config -- global user. Name "Jone Zhang"

$ Git config -- global user. Email jonezhang86@gmail.com

 

Additional content:

Mac
There are multiple ways to install git on Mac: the simplest method is to use git OS X installer. Open the git-OSX-installer page on Google Code and download the latest installation package. The latest version is GIT 1.7.5. Mount the DMG image to install git.

    • If you want to use git GUI, run the script in the DMG image to install it.
    • If you want to use package management similar to Homebrew or macports for installation, it is also very simple.

Homebrew

$SudoBrewInstall Git

Macports

 

 
$SudoPort selfupdate $SudoPortInstallGit-core

(SUDO is a command that has the root user permission to run; it is usually required to install software. If sudo is used, the command line requires the user password .)

If you want to experience git more deeply, install it from the source code. First, install Apple Developer Tools-xcode. Can be downloaded in the http://developer.apple.com/mac.
Install git in the/usr/local directory to ensure that terminal can be found in the $ PATH environment variable. Check the/usr/local/bin path (bin indicates binary, And the compiled git report is included in the subdirectory ). If no longer, open. Profile and add it to the end.

Export Path="/USR/Local/Bin:$ Path"

After saving the close. profile file, restart terminal. Run echo $ path and check that/usr/local/bin is in the $ PATH environment variable.
Now we can start to install git. If you are not familiar with the command line, you can install it using the previous method. If there is no problem, start.
Download and decompress the GIT source code:

$ Curl-OHTTP://Kernel.org/Pub/Software/SCM/Git/Git-1.7.5.tar.bz2 $TarXzvf git-1.7.5

Open the Directory and compile git:

$CDGit-1.7.5 $./Configure-- Prefix=/USR/Local$Make$Make Install

Done! Now you can delete this directory.

 
$CD... $RmGit-1.7.5 $RmGit-1.5.1.tar.bz2

You should see that git has been successfully installed. Check the installation location:

$Which Git

/Usr/local/bin/git should be obtained. If it is correct, it indicates that 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.