致命的Git:不支持协议'https'

hli*_*nee 76 git

我正在阅读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
Run Code Online (Sandbox Code Playgroud)

还尝试使用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.
Run Code Online (Sandbox Code Playgroud)

我需要在计算机上更改某些配置设置,还是GitHub有问题?

编辑:我已经用“。”替换了我的用户名和IP地址。

小智 194

问题可能是这样。

您尝试使用粘贴

  • CTRL + V

之前它没有用,所以您继续将其粘贴到经典

  • Right Click -粘贴**。

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

  • 一个隐藏的 ^?

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

您仅在您之后出现的字符

  • backspace

(继续尝试git bash)。

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

这是无效的。

  • 谢谢!我删除并重写了https的h并且它有效! (15认同)
  • 伙计,你吓坏了我……就像有人在我的肩膀上监视着一样。 (11认同)
  • 这个隐藏的性格问题不可能不是某种恶作剧。 (10认同)
  • 就是这样。我正在使用 MINGW。我在粘贴之前尝试了 ctrl+v 和 shift+ctrl+v 但失败了,但在使用 GUI 粘贴选项再次尝试后,它成功克隆了我的存储库。谢谢! (7认同)
  • 那行得通,谢谢!我用鼠标右键粘贴它。然后,我将光标放在“https”中间并多次按 Backspace (5认同)
  • 不敢相信我们必须处理这样的事情。看不见的字符使您的工作持续更长的时间。谢谢!为我工作。 (4认同)
  • 这是解决方案! (3认同)
  • 但为什么会出现这种情况呢? (3认同)
  • 如果您使用 GitHub Desktop 或任何其他 GUI Git 软件,请确保仅复制并粘贴 URL,而不在开头使用 git clone。 (2认同)

Tom*_*ing 22

编辑: 通过启动新的终端会话,解决了此特定用户的问题。

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

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

或这个:

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

选择要克隆的位置

  • 谢谢-我重新启动了命令行,由于某种原因,现在它可以工作了。我仍然很困惑为什么一开始就没有用。 (2认同)
  • 重新启动终端可解决此问题 (2认同)

小智 11

简单的答案是只需删除https

您的回购。:(git clone https:// ........

就像那样(git clone:// .......)

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

问题解决100%...


小智 11

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


Ram*_*esh 6

从普通记事本复制:

git clone https://github.com/./Spoon-Knife.git
Run Code Online (Sandbox Code Playgroud)

然后粘贴到cmd中。


gcb*_*gcb 5

有一些可疑的事情正在发生。可能是一个不一致的 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
Run Code Online (Sandbox Code Playgroud)

历史命令不显示额外的字符。就像我将它复制粘贴到终端时没有渲染一样。你可以看到我是如何尝试删除“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
Run Code Online (Sandbox Code Playgroud)

有IAc2 96网址前CHAR插入。不知道那是什么。它不是扩展的 ASCII(它会在哪里–)并且它在我粘贴在剪贴板上时几乎从我粘贴的每个地方都隐藏起来。我用这个十六进制值找到的最接近的是https://www.fileformat.info/info/unicode/char/c298/index.htm但我没有在任何地方看到 utf 前缀(同样,可能已经丢失了)

这一切都可能会产生误导,因为我丢失了页面/剪贴板,并且只从保存的 shell 历史文件中工作,这很可能会丢失原始错误/恶意注入中的数据。


小智 5

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

(它以某种方式显示您在开始时使用了两个引号,不知道为什么)。

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