我是廣告,點擊一下吧!
標籤
#Flutter (11) 、 #PHP (8) 、 #Laravel (6) 、 #Mac (4) 、 #Dart (4) 、 #MySQL (4) 、 #VS Code (2) 、 #IDE (2) 、 #List (2) 、 #Android (2) 、 #Linux (2) 、 #Shell Script (2) 、 #addMonthNoOverflow (1) 、 #Deferred Join (1) 、 #subMonthNoOverflow (1) 、 #floorMonth (1) 、 #資安 (1) 、 #SVG (1) 、 #Directory Structure (1) 、 #SQL Injection (1) 、 #MySQL 效能 (1) 、 #subMonth (1) 、 #addMonth (1) 、 #Carbon (1) 、 #keytool (1) 、 #Play App Signing (1) 、 #copy (1) 、 #file_put_contents (1) 、 #file_get_contents (1) 、 #fwrite (1)SSH Key 可以讓對方 server 快速驗證你的身份,不用再輸入帳號密碼,方便的好東西。
使用 SSH Key 需要兩步驟:
開啟你的 Terminal,執行
ssh-keygen
會詢問你要不要自訂存放位置,我是直接 Enter 使用預設
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/mtsung/.ssh/id_rsa):
會詢問你要不要定義密碼,這樣你每次使用都要輸入密碼,我很懶所以連按了兩次 Enter
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
你的資料夾內就會產生一組私鑰 (id_rsa
) 與公鑰 (id_rsa.pub
)
把公鑰 (id_rsa.pub
) cat 出來,複製內容
mtsung@MTsung-Toby-MacBook ~ % cat .ssh/id_rsa.pub
ssh-rsa AAAAB3Nza......略......6gH1ExU51ochUsKME= mtsung@caimincongdeAir
連上 Server 將剛剛複製的內容貼到 ~/.ssh/authorized_keys
最後一行
echo "ssh-rsa AAAAB3Nza......略......6gH1ExU51ochUsKME= mtsung@caimincongdeAir" > ~/.ssh/authorized_keys
登入你的 GitHub > Settings > SSH and GPG keys > New SSH key