一、安裝Git
MAC安裝Git
首先查看電腦是否安裝Git,終端輸入:
git
1、通過homebrew安裝Git
-
1、未安裝homebrew,需安裝homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
2、安裝git
brew install git
二、創建ssh key、配置git
-
1、設置username和email(github每次commit都會記錄他們)
git config --global user.name "imworking"
git config --global user.email "[email protected]"
-
2、通過終端命令創建ssh key
ssh-keygen -t rsa -C "imwork@qq.com"
[email protected]是我的郵件名,回車會有以下輸出
0---:git imwork$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/imwork/.ssh/id_rsa):
/Users/imwork/.ssh/id_rsa already exists.
Overwrite (y/n)? n
由於這裏我原來已經創建過,這裏我選n,沒有創建過的,會要求確認路徑和輸入密碼,我們這使用默認的一路回車就行。成功的話會在~/下生成.ssh文件夾,進去,打開id_rsa.pub,複製裏面的key。
終端查看.ssh/id_rsa.pub文件
open .ssh/id_rsa.pub
回車後,就會新彈出一個終端,然後複製裏面的key。
或者用cat命令查看
cat .ssh/id_rsa.pub
-
3、登錄GitHub(默認你已經註冊了GitHub賬號),添加ssh key,點擊Settings,點擊New SSH key,添加key
-
4、鏈接驗證
ssh -T [email protected]
終端輸出結果
0---:git imwork$ ssh -T [email protected]
Enter passphrase for key '/Users/imwork/.ssh/id_rsa':
Hi imwork! You've successfully authenticated, but GitHub does not provide shell access.
二、配置Gitlab
1、登錄部署好的gitLab服務,將生成的密鑰放置SSH Key,生成token
、
保存好token ,
3、ieda 中配置gitLab
1、下載gitlab客戶端,安裝
2、在idea設置中的Plugins中搜索gitlab project 下載安裝
3、在VersionControl中選擇gitLab ,設置token,結束