# SSH 配置 ### 建立SSH Key ``` sh= ssh-keygen -t ed25519 -C "your_email@example.com" ``` >終端機輸入 ``` Generating public/private rsa key pair. Enter file in which to save the key (/home/jimmyy5121/.ssh/id_rsa):(直接enter) Enter passphrase (empty for no passphrase): (輸入密碼) Enter same passphrase again: (再次輸入密碼) Your identification has been saved in /home/jimmyy5121/.ssh/id_rsa. Your public key has been saved in /home/jimmyy5121/.ssh/id_rsa.pub. The key fingerprint is: SHA256:fe...... jimmyy5121@jim-nuxt The key's randomart image is: +---[RSA 2048]----+ | | | . | | o . . .| | .... | +----[SHA256]-----+ ``` > SSH 不用設置密碼 #### 獲取公鑰 ``` sh= cat ~/.ssh/產生的檔名.pub ``` >打開.pub檔案獲取公鑰 ``` ssh-rsa AAAA........ ``` >把一長串公鑰複製起來 ### 接著把這一長串公鑰貼在遠端數據庫裡 * Github 打開Github Settings -> SSH and GPG keys -> SSH keys -> New SSH key * GitLab ![](https://hackmd.io/_uploads/HyYBCZtW2.png) ### 遠程庫設定SSH完成 設定完成,此時就可以SSH去Git Clone專案了! ### Source tree SSH配置 ![](https://hackmd.io/_uploads/Hk5TCnZzj.png) > PuTTy 切換成 OpenSSH ![](https://hackmd.io/_uploads/BkHNJa-fi.png) > Source tree開啟建議, > 兩個選項主要是開啟 Pull Rebase > 以及 Force Push