我的本地計算機使用的是win10,gitbash客戶端,之前本地倉庫和github遠程倉庫可以通過ssh雙向正常通信(拉/克隆或推送等),但是這次當我拉取遠程代碼到本地更新時,我得到一個錯誤。
git pull origin main
Connection reset by 140.82.112.4 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
然后我嘗試了以下命令以查看它是否有效。
ssh -vT [email protected] -A
OpenSSH_8.3p1, OpenSSL 1.1.1g 21 Apr 2020
debug1: Reading configuration data /c/Users/Administrator/.ssh/config
debug1: /c/Users/Administrator/.ssh/config line 2: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [140.82.112.4] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Administrator/.ssh/id_rsa type 0
debug1: identity file /c/Users/Administrator/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3
debug1: Remote protocol version 2.0, remote software version babeld-25270101
debug1: no match: babeld-25270101
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
Connection reset by 140.82.112.4 port 22
它還使用以下命令對其進行了測驗。
ping github.com
正在 Ping github.com [140.82.112.4] 具有 32 位元組的資料:
來自 140.82.112.4 的回復: 位元組=32 時間=222ms TTL=44
來自 140.82.112.4 的回復: 位元組=32 時間=222ms TTL=44
來自 140.82.112.4 的回復: 位元組=32 時間=222ms TTL=44
來自 140.82.112.4 的回復: 位元組=32 時間=222ms TTL=44
140.82.112.4 的 Ping 統計資訊:
資料包: 已發送 = 4,已接收 = 4,丟失 = 0 (0% 丟失),
往返行程的估計時間(以毫秒為單位):
最短 = 222ms,最長 = 222ms,平均 = 222ms
我也試過重新生成ssh密鑰,然后將公鑰正確復制到我的GitHub賬戶的ssh配置中,本地計算機.ssh/config檔案如下
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
結果還是不成功。
它似乎連接正確嗎?我能做些什么來修復它?
uj5u.com熱心網友回復:
ssh -vT [email protected] -A: 你不應該自己使用代理轉發github.com。
測驗應該是:
# Attempt to SSH in to github
ssh -T [email protected]
> Hi USERNAME! You've successfully authenticated, but GitHub does not provide
> shell access.
查看“使用 SSH 代理轉發”檔案,看看它是否適用于您的情況。
注意::/c/Users/Administrator/.ssh/config最好不要使用您的 Windows 管理員帳戶,而是使用您最初登錄到 Windows 會話時使用的個人命名帳戶。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/536318.html
標籤:混帐知乎ssh
