簡體   English   中英

嘗試連接到 git 上的遠程存儲庫時出現“ssh_exchange_identification: read: Connection reset by peer”錯誤

[英]"ssh_exchange_identification: read: Connection reset by peer" error when trying to connect to remote repository on git

我是 github 的新手,我大約兩周前開始使用它。 一切都很完美,我能夠從我的遠程存儲庫中推送和拉取。 然而,今天,當我試圖從中提取時,我收到了這條錯誤消息:

ssh_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

當我嘗試執行任何連接到我的遠程 github 存儲庫(推送、拉取、獲取等)的操作時,實際上,它會返回相同的錯誤。

當我輸入這個命令時:“ssh -T git@github.com”,我得到:

ssh_exchange_identification: read: Connection reset by peer

我沒有修改我的存儲庫或我的 SSH 密鑰或任何東西中的任何設置,所以我不知道為什么它突然停止工作。 可能是什么問題呢?

我最近遇到了類似的問題,我不確定它是否與我通過以下命令獲得連接的用戶完全相同。

ssh -T git@gitlab.com

但是當我嘗試將代碼推送到遠程存儲庫時,我得到了同樣的錯誤。

kex_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

在嘗試了互聯網上的幾個解決方案但沒有成功后,我剛剛嘗試git init它對我有用。 我希望這僅在連接用戶已正確綁定時才有效。

試試看 祝你好運.. :)

我也遇到了這個問題,我可以通過重新啟動我的互聯網連接來解決它。

當 git bash 突然給我這個消息時,我很困惑。 我根本沒有對我的 git 存儲庫進行任何更改。 重新啟動我的連接修復了它。

做 git-init。 它將重新初始化連接

今天在 Bitbucket 上也發生了同樣的事情。 我首先嘗試git init作為另一個答復建議。 沒運氣。 然后很簡單,我剛剛重新啟動了我的電腦,一切又開始工作了。

我有同樣的事情,這對我有用:

git config http.sslVerify "false"

接着:

git remote rename origin old-origin

然后代替使用 ssh (git@YOUR_GIT_REPO.git) 使用https url 並將其設置為原點:

git remote add origin https://YOUR_GIT_REPO.git

在我的情況下,是因為 /etc/ssh/ssh_config 文件中的 ssh 端口已更改。 一旦我將 /etc/ssh/ssh_config 中的端口改回 22,我就能夠連接到 Gitlab。

我今天遇到了這個錯誤,想知道出了什么問題。 重新啟動。 還是很糟糕。 然后我去了 gitlab 網站,得到一個 503 錯誤,表明服務器不可用。 gitlab 正在他們的網站上進行重大維護,並表示將關閉兩個小時。

我只是發布這個以防其他人有這個問題。 在這種情況下,這不是本地問題,而是遠程 git 服務器。 git bash 錯誤消息非常神秘。 它說:

kex_exchange_identification: read: Connection reset by peer
Connection reset by 2606:4700:90:0:f22e:fbec:5bed:a9b9 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

經過一番努力,我已經解決了這個錯誤,但我認為這是一個愚蠢的想法,但它會起作用。

  • Go 到您的 git 項目並通過系統中的 HTTP 鏈接克隆它。
  • 之后,您將在克隆項目中獲得 git 文件夾。
  • 復制 git 文件夾並將其替換為 SSL 錯誤顯示項目。
  • 然后像往常一樣添加 git。 以此類推。它會正常推送。

享受

同樣的問題在這里我也有同樣的錯誤。 但在刪除.git 文件后,它工作正常,但不知何故一次又一次地重復.. kex_exchange_identification:讀取:對等連接重置連接由 13.234.210.38 端口 22 重置致命:無法從遠程存儲庫讀取。 請確保您擁有正確的訪問權限。 並且存儲庫存在。

我遇到了這個問題,因為我錯誤地將一個新的遠程倉庫(稱為origin )添加到我的本地 git 倉庫副本中。 您可以像這樣查看所有遙控器:

$ git remote -v
origin  git@my-host.com:1234/my-path/my-project.git (fetch)
origin  git@my-host.com:1234/my-path/my-project.git (push)

請注意協議 ( ssh:// ) 是如何丟失的。 這對我來說是錯誤的。 所以只需刪除舊的遠程倉庫:

$ git remote rm origin
$ git remote -v
# empty

然后添加正確的遠程倉庫(稱為origin ):

$ git remote add origin ssh://git@my-host.com:1234/my-path/my-project.git
$ git remote -v
origin  ssh://git@my-host.com:1234/my-path/my-project.git (fetch)
origin  ssh://git@my-host.com:1234/my-path/my-project.git (push)

我不得不刷新 dns 來解決這個問題。

在 Windows 或 WSL 上,打開管理員 powershell 並執行ipconfig /flushdns 然后使用wsl.exe -t Ubuntu重新啟動 WSL,也許是整個 PC。

在 Ubuntu + VSCode 終端上並使用 Bitbucket:

重新啟動沒有用。

重新初始化回購工作:

$ git init

我的情況與他的回答中的@osama-heba 相同。

解決方案是更改端口。 如果是 22,嘗試更改為 443,反之亦然。

  1. 在 ubuntu 中,更改端口:

     sudo nano ~/.ssh/config
  2. 嘗試刪除原點並重新添加它(這里,我使用 GitHub 例如),

     git remote rm origin git remote add origin git@github.com:USERNAME/REPONAME.git
  3. 要測試和初始化連接,您可以從遠程推送或拉取。 或者在 GitHub 中,使用:

     ssh -T git@github.com

這些都不適合我:重啟 wifi 卡,git init。 我沒有嘗試重新啟動。

我只在像 PyCharm 這樣使用 IDE 時才看到這個問題,而且只有幾個月。

在我的例子中,我有大約 20 個 git 存儲庫托管在 github 中。如果我只更新少量 git 存儲庫,則不會出現問題。

web 搜索表明 github不會限制 git 獲取,但也許這是尚未公布的最新更改?

同樣的問題也發生在我的 bitbucket 存儲庫上,我所做的只是刪除這個存儲庫並用另一個名稱創建另一個,在 locla 我只修改了遠程的 url

git remote set-url origin git@bitbucket.org:USERNAME/REPOSITORY.git

要了解有關更改存儲庫的 URL 的更多信息,請單擊此處的鏈接:changeing -a-remotes-url

我遇到了這個問題,因為我連接到了其中一個 VPN

您使用的接入點可能會阻止某些類型的通信。 我只是在使用我大學的 wifi 網絡時遇到了這個問題,當我將連接更改為我的手機服務時,它工作得很好

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM