将远程 URL 从 SSH 切换到 HTTPS 解决git kex_exchange_identification: Connection closed by remote host

 

git clone 时选择的是SSH链接,使用HTTPS链接地址进行下载就可以啦!

 

 

 

 

更改url

将远程 URL 从 SSH 切换到 HTTPS

  1. 打开 Git Bash。
  2. 将当前工作目录更改为您的本地仓库。
  3. 列出现有远程仓库以获取要更改的远程仓库的名称。
    $ git remote -v
    > origin  git@github.com:USERNAME/REPOSITORY.git (fetch)
    > origin  git@github.com:USERNAME/REPOSITORY.git (push)
  4. 使用 git remote set-url 命令将远程的 URL 从 SSH 更改为 HTTPS。
    $ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
  5. 验证远程 URL 是否已更改。
    $ git remote -v
    # Verify new remote URL
    > origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
    > origin  https://github.com/USERNAME/REPOSITORY.git (push)

 

posted on 2022-03-31 12:03  tycoon3  阅读(667)  评论(0)    收藏  举报

导航