Git 严重:不支持协议 'https'

Git fatal: protocol 'https' is not supported

我正在阅读 Github 的分叉指南:https://guides.github.com/activities/forking/ 我正在尝试将存储库克隆到我的计算机上。但是,运行命令:

$ git clone https://github.com/./Spoon-Knife.git
Cloning into 'Spoon-Knife'...
fatal: protocol 'https' is not supported

也尝试使用 SSH:

$ git clone git@github.com:./Spoon-Knife.git
Cloning into 'Spoon-Knife'...
Warning: Permanently added the RSA host key for IP address '.' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

我是否需要更改计算机上的某些配置设置,或者这是 GitHub 的问题?

编辑:我已将我的用户名和 IP 地址替换为“.”

编辑: 这个特定的用户问题已通过启动新的终端会话解决。

不支持协议 (https) 之前的 ?。你想要这个:

git clone git@github.com:octocat/Spoon-Knife.git

或者这个:

git clone https://github.com/octocat/Spoon-Knife.git

发生了一些可疑的事情。可能是 github 不一致的错误(A/B 测试?)

我在 windows10,使用 firefox。我刚刚复制了一个结帐 URL 并得到了一个额外的字符。但只是第一次。第二次它不在那里。我必须查看我的历史文件才能看到它!

这是我的历史:

git clone --recursive https://github.com/amzeratul/halley-template
git clone --recursive http://github.com/amzeratul/halley-template
git clone --recursive github.com/amzeratul/halley-template
git clone --recursive https://github.com/amzeratul/halley-template

历史命令不显示额外的字符。就像我将它复制粘贴到终端时它没有被渲染一样。您可以看到我是如何尝试删除 's' 然后删除整个协议的吗?当退格键移动的字符比我预期的少一个时,我才被触发进一步调查!

我用十六进制编辑器将我的 shell 历史文件保存到一台机器上,并且:

00000000  xx xx xx xx xx xx xx 0a  67 69 74 20 63 6c 6f 6e  |xxxxxxx.git clon|
00000010  65 20 2d 2d 72 65 63 75  72 73 69 76 65 20 c2 96  |e --recursive ..|
00000020  68 74 74 70 73 3a 2f 2f  67 69 74 68 75 62 2e 63  |https://github.c|
00000030  6f 6d 2f 61 6d 7a 65 72  61 74 75 6c 2f 68 61 6c  |om/amzeratul/hal|
00000040  6c 65 79 2d 74 65 6d 70  6c 61 74 65 0a 67 69 74  |ley-template.git|
00000050  20 2d 2d 68 65 6c 70 0a  67 69 74 20 75 70 64 61  | --help.git upda|
00000060  74 65 2d 67 69 74 2d 66  6f 72 2d 77 69 6e 64 6f  |te-git-for-windo|
00000070  77 73 0a 67 69 74 20 63  6c 6f 6e 65 20 2d 2d 72  |ws.git clone --r|
00000080  65 63 75 72 73 69 76 65  20 c2 96 68 74 74 70 73  |ecursive ..https|
00000090  3a 2f 2f 67 69 74 68 75  62 2e 63 6f 6d 2f 61 6d  |://github.com/am|
000000a0  7a 65 72 61 74 75 6c 2f  68 61 6c 6c 65 79 2d 74  |zeratul/halley-t|
000000b0  65 6d 70 6c 61 74 65 0a  63 75 72 6c 20 2d 2d 76  |emplate.curl --v|
000000c0  65 72 73 69 6f 6e 0a 63  64 20 63 6f 64 65 0a 67  |ersion.cd code.g|
000000d0  69 74 20 63 6c 6f 6e 65  20 2d 2d 72 65 63 75 72  |it clone --recur|
000000e0  73 69 76 65 20 c2 96 68  74 74 70 73 3a 2f 2f 67  |sive ..https://g|
000000f0  69 74 68 75 62 2e 63 6f  6d 2f 61 6d 7a 65 72 61  |ithub.com/amzera|
00000100  74 75 6c 2f 68 61 6c 6c  65 79 2d 74 65 6d 70 6c  |tul/halley-templ|
00000110  61 74 65 0a 67 69 74 20  63 6c 6f 6e 65 20 2d 2d  |ate.git clone --|
00000120  72 65 63 75 72 73 69 76  65 20 c2 96 68 74 74 70  |recursive ..http|
00000130  3a 2f 2f 67 69 74 68 75  62 2e 63 6f 6d 2f 61 6d  |://github.com/am|
00000140  7a 65 72 61 74 75 6c 2f  68 61 6c 6c 65 79 2d 74  |zeratul/halley-t|
00000150  65 6d 70 6c 61 74 65 0a  67 69 74 20 63 6c 6f 6e  |emplate.git clon|
00000160  65 20 2d 2d 72 65 63 75  72 73 69 76 65 20 67 69  |e --recursive gi|
00000170  74 68 75 62 2e 63 6f 6d  2f 61 6d 7a 65 72 61 74  |thub.com/amzerat|
00000180  75 6c 2f 68 61 6c 6c 65  79 2d 74 65 6d 70 6c 61  |ul/halley-templa|
00000190  74 65 0a 67 69 74 20 63  6c 6f 6e 65 20 2d 2d 72  |te.git clone --r|
000001a0  65 63 75 72 73 69 76 65  20 68 74 74 70 73 3a 2f  |ecursive https:/|
000001b0  2f 67 69 74 68 75 62 2e  63 6f 6d 2f 61 6d 7a 65  |/github.com/amze|
000001c0  72 61 74 75 6c 2f 68 61  6c 6c 65 79 2d 74 65 6d  |ratul/halley-tem|
000001d0  70 6c 61 74 65 0a                                 |plate.|
000001d6

在 url 之前插入了一个 c2 96 字符。不知道那是什么。它不是扩展的 ASCII(它应该是 –)吗?当它在剪贴板上时,它几乎被我粘贴的每个地方都隐藏了。我找到的最接近这个十六进制值的是 https://www.fileformat.info/info/unicode/char/c298/index.htm 但我没有在任何地方看到 utf 前缀(同样,可能已经丢失)

这一切可能会产生误导,因为我丢失了 page/clipboard 并且我只使用保存的 shell 历史文件,这很可能会丢失原始 bug/malicious 注入中的数据.

简单的答案就是删除 https

你的回购。 : (git 克隆 https://........)

就像那样 (git 克隆 ://......)

然后再次输入 (git clone https://.......)

我在 Windows 10 和 运行 上首次安装 git 后遇到了同样的问题。重新启动 bash window 解决了问题。

大概是这个问题

您尝试使用

粘贴它
  • CTRL + V

之前它没有用,所以你继续用经典粘贴它

  • 右击 - 粘贴**。

可悲的是,每当你在终端上输入CTRL + V时,它会添加

  • 一个隐藏^?

(至少在我的机器上是这样编码的)。

你之后才出现的角色

  • 退格

(继续尝试 git bash)。

所以你的 link 变成 ^?https://...

无效。

只需在 URL 中使用双引号,例如:git clone "https://yourRepoUrl"

(它不知何故看到你在开始时使用了 2 个引号,不知道为什么)。

我遇到了同样的错误 => fatal: protocol ''https' is not supported(您可以在 https 上看到 2 个引号)。

我遇到了同样的问题,我所做的只是重新启动命令行,然后使用命令 ''cd documents'' 导航到文档文件夹而不是用户文件夹。这应该是所有需要的。还要确保 link 是正确的。

您可能正在使用尚未登录 git 集线器的 Windows 或 Linux 计算机,因此未验证证书。从出现错误的系统使用凭据登录 GitHub,然后尝试使用它将起作用的命令。

使用http代替https;它会给出警告消息并重定向到 https,克隆没有任何问题。

$ git clone http://github.com/karthikeyana/currency-note-classifier-counter.git
Cloning into 'currency-note-classifier-counter'...
warning: redirecting to https://github.com/karthikeyana/currency-note-classifier-counter.git
remote: Enumerating objects: 533, done.
remote: Total 533 (delta 0), reused 0 (delta 0), pack-reused 533
Receiving objects: 100% (533/533), 608.96 KiB | 29.00 KiB/s, done.
Resolving deltas: 100% (295/295), done.

Problem

git clone https://github.com/rojarfast1991/TestGit.git fatal: protocol 'https' is not supported

解决方案:

步骤:

(1):- 打开新终端并克隆 git 存储库

git clone https://github.com/rojarfast1991/TestGit.git

(2) 自动 git 登录提示将打开,并要求您输入用户凭据。

用户名:- xxxxxxx

密码:- xxxxxxx

终于,克隆开始了...

git clone https://github.com/rojarfast1991/TestGit.git
Cloning into 'TestGit'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.

从普通记事本复制:

git clone https://github.com/./Spoon-Knife.git

然后粘贴到cmd中

我尝试了很多方法来解决这个问题。但是我一次又一次地失败了。然后我这样做了:

打开 Git Bash > 转到您的 directory > 粘贴 然后 git clone https://shahadat@bitbucket.org/*******.git 将显示命令提示符以提供登录信息证书。提供凭据并克隆您的项目。

你试过这个:

Ctrl + V

只需右键单击并单击粘贴

当我试图变得聪明并从 repo 的 URL 中提取克隆 URL 时,我遇到了这个错误。我做错了。我在做:

git@https://github.company.com/Project/Core-iOS

我必须做的事情:

git@github.company.com:Project/Core-iOS.git

我犯了 3 个错误:

  • 不需要https://
  • .com 之后我需要 : 而不是 /
  • 最后我需要一个.git

即使在

修复后这个问题仍然存在

更具体的,我粘贴了link没有"Ctrl + v",但它仍然给了fatal: protocol 'https' is not supported

但是 如果您在 Windows 或 Google 搜索栏中复制该消息,您会发现实际消息是 fatal: protocol '##https' is not supported,其中'#' 代表 this character。如您所见,那2个字符还没有被删除。

我正在研究 IntelliJ IDEA Community Edition 2019.2.3,以下修复是指此工具,答案是那 2 个字符仍然存在,需要从 link.

删除

IntelliJ 修复

转到顶部栏,select VCS -> Git -> Remotes... 然后单击。

现在它会打开一些东西link这个

你可以看到那2个无法识别的字符。我们必须删除它们。单击编辑图标并删除这 2 个字符,或者您可以删除 link 并添加一个新字符。

确保您的项目文件夹中有“.git”文件夹.

现在应该是这样的。单击 "Ok",现在您可以将文件推送到 git 存储库。

只需添加此 git config --global http.sslVerify false ,这样它就不会检查证书。

如果您使用 Git Bash:

不要按 Ctrl + V.
粘贴 link 您只需键入 git 克隆 右键单击​​ ,然后 粘贴

我在尝试通过 Visual Studio 克隆时遇到此错误。当我在 PowerShell 中做同样的事情时,它工作得很好。

我收到一个看起来与此非常相似的错误,因为我在 URL:

周围加上了单引号

fatal: protocol ''https' is not supported

从 URL 中删除单引号解决了问题。

如果您使用 Visual Studio 或 Git GUI 进行克隆,您需要删除“git 克隆”命令。只需要地址。

将项目上传到 GITHUB

git init
echo . > .gitignore
git commit -m "commit"
git remote add origin "https://github.com/anmolmishra99/Delhi-Flask-WebApp.git"
git remote -v
git pull origin master 
git push origin master

人们通常在 Github 或 Bitbucket 中单击复制按钮并将其粘贴到 Visual Studio 中的“克隆存储库”页面。

您需要删除复制内容前面的“git 克隆”命令。只需粘贴以“https://....”开头的 URL。然后它应该工作。

否则,您将收到 https 不受支持的消息。

就我而言,pushurl 开头有一个 space 字符(.git\config 文件)

[remote "origin"]
url = https://gitlab____.git
fetch = +refs/heads/*:refs/remotes/origin/*
pushurl = " https://gitlab____.git"

删除,问题解决