mac 安裝 git

Git與Github區(qū)別

Git是一個分布式版本控制系統(tǒng),簡單的說其就是一個軟件或命令。

Github(https://www.github.com)是一個為用戶提供Git服務的網站,簡單說就是一個可以存放代碼的地方。類似github的網站功能的有很多,如國內的https://gitee.com/。

github就是提供git遠程倉庫。

安裝與配置

首先查看電腦是否安裝Git,終端輸入:

git

1.通過homebrew安裝Git

brew install git

2.通過下載安裝

下載地址:https://git-scm.com/downloads

GUI下載:https://tortoisegit.org/download/

配置git

設置username和email

git config --global user.name "phpdalao"

git config --global user.email "phpdalao@163.com"

通過終端命令創(chuàng)建ssh key

ssh-keygen -t rsa -C "phpdalao@163.com"

沒有創(chuàng)建過的,會要求確認路徑和輸入密碼,我們這使用默認的一路回車就行。成功的話會在~/下生成.ssh文件夾,進去,打開id_rsa.pub,復制里面的key。


終端查看.ssh/id_rsa.pub文件

用cat命令查看

cat .ssh/id_rsa.pub

登錄GitHub(默認你已經注冊了GitHub賬號),添加ssh key,點擊Settings,如圖



添加key (title 隨便寫, key 寫 剛才復制的key)

鏈接驗證

ssh -T git@github.com

終端輸出結果

bogon:~ ly$ ssh -T git@github.com

The authenticity of host 'github.com (13.250.177.223)' can't be established.

RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.

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

Warning: Permanently added 'github.com,13.250.177.223' (RSA) to the list of known hosts.

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

bogon:~ ly$

說明已經鏈接成功。

下一篇? 寫git提交項目到 github

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容