Mac OS X安裝Git

來源:互聯網
上載者:User

一、安裝Git

由於mac git的地址http://code.google.com/p/git-osx-installer/被牆,被迫使用源碼安裝,源碼可以從http://kernel.org/pub/software/scm/git/下載,編譯源碼需要先安裝xcode,參考http://developer.apple.com。

編譯安裝

1、解壓

tar xjvf git-1.7.4.1.tar.tar.bz2

2. 編譯

     cd git-1.7.4.1

     ./configure --prefix=/usr/local

     make

3.安裝

     sudo make install

 

Ok 了,which git試一下~

二、設定SSH

github使用SSH連結,需要設定SSH

1.檢查SSH key

     cd ~/.ssh

2.備份已有的key,(如果有的話)

     mkdir key_backup

     mv id_rsa* key_backup

3.產生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.將SSH key添加到GitHub

登入到GitHub頁面,Account Settings->SSH Public Keys->Add another key

將產生的key(id_rsa.pub檔案)內容copy到輸入框中,save。

5.測試連結

$ 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.

別擔心,這是正常情況。

三、設定個人資訊

$ git config --global user.name "Bo Jiang"

$ git config --global user.email "jiang.bo.hit@gmail.com"

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.