在使用GitHub的時候,爲了不每次輸入用戶名密碼,都會使用SSH方式代替Https。git
按網上教程,大多數使用SSH-KeyGen生成公私鑰對,然後上傳公鑰至Github,並切換Repositorie爲SSH.github
使用SSH-KeyGen輸出以下:ssh
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory ‘/root/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub. ide
注意點在紅色部分,若是使用了passphrase,在VSCode中提交或獲取代碼會報錯 - Permission denied (publickey)spa
解決辦法: 不使用passphrase,從新生成祕鑰對。code
具體狀況請看: https://github.com/Microsoft/vscode/issues/6202blog