Mac git configuration

Source: Internet
Author: User

GitHub uses SSH links and needs to set up SSH

1. Check SSH key

CD ~/.ssh

2. Back up the existing key (if any)

mkdir Key_backup

MV id_rsa* Key_backup

3. Generate SSH Key

$ ssh-keygen-t rsa-c [email protected]

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 have been saved in Yes.

Your public key had 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 [email protected]

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 contents of the generated key (Id_rsa.pub file) into the input box, save.

5. Test Links

$ SSH [email protected]

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.

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

PTY allocation request failed on channel 0

Hi Jone zhang! You'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 a shell login but is connected successfully)

Third, set up personal information

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

$ git config--global user.email [email protected]

Supplemental content:

Mac

There are several ways to install Git on your MAC: The simplest way is to use git OS X Installer. Open the git-osx-installer page on Google Code to download the latest installation package. Now the latest is Git 1.7.5. Mount the DMG image to install Git.

    • If you want to use the Git GUI, then run the script in the DMG image to install it.
    • If you want to install with package management similar to Homebrew or MacPorts, it is also very simple.

Homebrew

$ sudo brew install git

MacPorts

$ sudo port selfupdate

$ sudo port install git-core

(sudo is the root user right to run the command; It is usually necessary to install the software.) If you use sudo, the command line asks for a user password. )

If you want to experience Git more deeply, install it from the source code. First, you need to install Apple Developer tools– Xcode. Can be downloaded from http://developer.apple.com/mac/ .

We installed Git in the/usr/local directory, making sure that Terminal can be found in the $PATH environment variables. Check the/usr/local/bin path (bin stands for binary, compiled Git report exists in subdirectories). If no longer, open. Profile to last.

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

After you save the close. profile file, restart Terminal. Run the echo $PATH you should see/usr/local/bin in the $PATH environment variable.

Now that we can start installing Git, if you're not familiar with the command line, you can install it using the previous method. If there is no problem, let's get started.

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

$ 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 successfully installed to see the installation location:

$ which git

Should get/usr/local/bin/git. If it is correct, you have successfully installed git! from the source code

ICC Develop Center

Mac git configuration

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.