我正在嘗試配置 git,這樣我就不必繼續進行身份驗證(并且還要了解更多關于 git 的知識)。
我以前一直在使用基于密碼的身份驗證,這是重復輸入我的密碼。我按照步驟(使用 Windows)在 github 中設定 SSH 密鑰。我為我的密鑰指定了一個特定的名稱,預計在某些時候我將需要多個 SSH 密鑰。id_rsa總是擁有github是沒有意義的!我收到了成功創建密鑰的電子郵件,我使用 git bash(因為 windows)靜默啟動 SSH 客戶端并添加了我的私鑰。但是運行 agit clone給了我這個錯誤:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
然后我想用默認名稱 ( id_rsa) 來嘗試它,而不是我的自定義名稱,當然它可以作業。所以我的問題是如何避免這種情況?我不希望為 github 保留默認名稱。
uj5u.com熱心網友回復:
您可以設定一個 ssh組態檔來告訴ssh命令在連接到 github 時使用該特定密鑰。
使用以下內容創建檔案.ssh/config:
Host github.com
IdentityFile ~/.ssh/github_rsa_key
假設您已命名您的 private key ~/.ssh/github_rsa_key。
現在嘗試連接到 github:
$ ssh [email protected]
你應該看到:
Hi <your github username>! You've successfully authenticated, but GitHub does not provide shell access.
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/488196.html
下一篇:如何僅對特定提交進行變基?
