MAC Learning Series git environment configuration and usage

Source: Internet
Author: User

Objective

Keep a record of your studies.

First, install Git

Because Mac git address http://code.google.com/p/git-osx-installer/be wall, forced to use source code installation, source code can be from http://kernel.org/pub/software/scm/git/ Download, compile the source code need to install Xcode first, refer to http://developer.apple.com.

Compiling the installation

1. Decompression

Tar xjvf git-1.7.4.1.tar.tar.bz2

2. Compiling
 cd git-1.7.4.1 ./configure --prefix=/usr/local make
3. Installation
 sudo make install

Ok, which git try it ~

Second, set up SSH

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 jiang-bo! You've successfully authenticated, but GitHub does not provide shell access.

     Connection to github.com closed.

Don't worry, it's a normal situation.

Third, set up personal information

$ git config–global user.name "Ericky"

$ git config–global user.email "[Email protected]"

Iv. Pull and push use

At this point, the setup for Git and GitHub is complete, and here's how to push the local code onto GitHub and pull the code from GitHub.

The push code is as follows
Create a Repository:https in GitHub://github. com/to New Repository Enter Repository information ProjectName Create a code base locally: Create a folder asLocalRepository$mkdirTest to create a file$CDTest$viTest.txt Add a file toLocalRepository$gitAdd Test.txt InitializationLocalRepository$gitInit commit File$gitCommit-a defining a remote server alias$gitRemote add alias git@github. com:xxxxx/projectname.git the Local dataPushto GitHub.$git PushAlias Master so that the local code can bePushTo the repository in GitHub.
Pull code from GitHub:
      在github中搜到你想要pull的代码,如https://github.com/edgecase/ruby_koans      选择fork,将此repository fock到你的repository下      在本地创建local repository并初始化      使用命令:      $git pull git@github.com:xxxxx/ruby_koans.git      将github上的代码pull到local repository中

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

MAC Learning Series git environment configuration and usage

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.