天天看點

如何在mac上搭建GitHub

準備工作:

(a)安裝GIT http://git-scm.com/downloads/
 (b)注冊GitHub賬号 http://github.com
           

1, 檢查是否已經存在ssh目錄

打開終端,輸入: cd ~/.ssh
如果是第一次操作,會顯示:No such file or directory
           

2, 生成密鑰

輸入:ssh-keygen
接着連續3次回車即可
           

3, 檢查生成的密鑰檔案

輸入:ls
顯示:id_rsa       id_rsa.pub  known_hosts
密鑰生成成功!
           

4, 把pub key複制到github

輸入:cat id_rsa.pub
(cat指令會把檔案内容打到螢幕)
接着複制key檔案列印在終端的内容,
粘貼至github的sshkeys中,可以通過settings -> SSH keys找到
           

5,測試與Github的連接配接

輸入:ssh [email protected]
如果顯示:
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.
則表明連接配接成功了!
           

好了,到這裡Github在mac本地的配置基本完成了,當然還可以進行一些别的配置化工作,比如設定你Git的username和email位址,如下:

分别輸入->
git config --global user.name "Your name"
git config --global user.email "Your email"
           

最後,推薦使用Github desktop用戶端,友善從UI進行GIT操作。