git - 带有 ssh 地址的 Git 克隆失败
问题描述
我想使用命令从 Github 克隆一个 git repo
git clone git@github.com:rgov/Thunderbolt3Unblocker.git
但我明白了
Cloning into 'Thunderbolt3Unblocker'...
fatal: unable to access 'https://github.com:rgov/Thunderbolt3Unblocker.git/': Port number ended with 'r'
似乎 git 将用户名“rgov”解释为端口号?
git版本是2.27.0
解决方案
检查git config --global -l
任何 insteadOf 指令的输出,例如:
git config --global url."https://github.com".insteadOf git@github.com
这可以解释为什么被https://github.comgit@github.com
取代了
请注意,这个指令写得不好:它应该是:
git config --global url."https://github.com/".insteadOf git@github.com:
^^^ ^^^
这至少会给你一个有效的 HTTPS URL:
https://github.com/rgov/Thunderbolt3Unblocker.git
^^^
但是,如果您想使用 SSH,insteadOf
请从您的全局 git 配置中删除该指令。
git config --global --unset-all url."https:github.com".insteadof
推荐阅读
- swiftui - 如何在 SwiftUI 中对 Imagepicker 进行两次单独调用?
- python - Leetcode Problem 136. Single Number - 如何修复我的代码,逻辑是否有效?
- angular - 如何更新 ngModel 以及 Angular 6 中的点击事件
- python-3.x - 使用 PyCharm 和 Firefox 或 Chrome 的 Windows 机器上的 Selenuim webdriver 代码错误
- openmpi - 安装openmpi,编译失败,链接mpi_cxx
- excel - 如何在excel中按日期求和以达到一个数字
- android - 我在 Play 商店上发布了一个 Android 应用程序。如何在不要求用户重新下载的情况下将更改推送给用户
- reactjs - 为什么我的图片没有加载到我的页面中?
- r - 在 for 循环中使用 write_xlsx 将数据帧导出到多个工作表中
- python - RuntimeError:输入、输出和索引必须在当前设备上。(fill_mask("随机文本
.")