多個專案之GitHub SSH key密鑰的管理
Sharon Mai20230515, Mon
情境:當有多個Github上儲存的專案,需要使用到不同的密鑰管理。
創建密鑰
-
在根目錄進入.ssh/ 資料夾,若無則創建一個.ssh/ 資料夾
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
創建SSH Key,使用ed25519類型創建
-
打開終端機或右鍵點選Git Bash Here
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
輸入指令:
-
完整示範指令如下:
-
Github密鑰其餘步驟請參考:Ubuntu部署Django 4專案系列的公鑰設定
密鑰管理
使用設定檔
-
到 .ssh/ 資料夾內
-
創建名稱叫config的文件,並輸入以下內容:
-
完成資料內容如下圖:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Clone專案
使用Host別名分別開來
- 到想Clone的資料夾中
- 打開終端機或直接右鍵點選Git Bash Here
- 輸入指令
-
先到GitHub複製連結
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
-
在指令中貼上GitHub複製的連結:
-
調整如下:
-
完整示範指令如下:
-
成功如下圖🎉:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →