1. 註冊Gitlab帳號
2. SSH KEY設定
創建SSH Key
ssh-keygen 或 ssh-keygen -t rsa -C "[gitemail]"
Enter file in which to save the key (/Users/Jilin/.ssh/id_rsa):
---->enter
Enter passphrase (empty for no passphrase):
---->enter
Enter same passphrase again:
---->enter
複製ssh key到GitLab中
https://gitlab.com/profile/keys
- 打開 Gitlab介面
- 進到 個人資料設置 profile 介面
- 選擇 SSH Keys 將內容貼到 Key 裡面並按 Add Key 按鈕
- 完成 SSH Key 綁定動作
cat ~/.ssh/id_rsa.pub 或 pbcopy < ~/.ssh/id_rsa.pub
/*****************拷貝sshkey*****************/
ssh-rsa
........
git@gitlab.com:jilinjob/myproject.git
/*****************拷貝sshkey.end*****************/
3. git clone < repo URL > 下載專案
cd /myproject
git clone git@gitlab.com:jilinjob/myproject.git
Cloning into 'myproject'...
The authenticity of host 'gitlab.com (35.231.145.151)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.com,35.231.145.151' (ECDSA) to the list of known hosts.
warning: You appear to have cloned an empty repository.
4.git push 上傳專案
cd myproject
git status
git init
git remote add origin git@gitlab.com:[gitname].git
git add .
git commit -m "Initial commit"
git push -u origin master
出現訊息: Permission denied (publickey) 連結解決方式