Git 致命:不支持协议“https”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53988638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:21:36  来源:igfitidea点击:

Git fatal: protocol 'https' is not supported

git

提问by hlinee

I am going through Github's forking guide: https://guides.github.com/activities/forking/and I am trying to clone the repository onto my computer. However, running the command:

我正在浏览 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

Also tried with SSH:

还尝试使用 SSH:

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

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

Do I need to change some configuration setting on my computer or is this a problem with GitHub?

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

Edit: I have replaced my username and IP address with "."

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

回答by user11452886

Problem is probably this.

问题大概是这个。

You tried to paste it using

您尝试使用粘贴它

  • CTRL+V
  • CTRL+V

before and it didn't work so you went ahead and pasted it with classic

之前它不起作用所以你继续用经典粘贴它

  • Right Click- Paste**.
  • Right Click- 粘贴**。

Sadly whenever you enter CTRL+V on terminalit adds

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

  • a hidden^?
  • 一个隐藏的^?

(at least on my machine it encoded like that).

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

the character that you only appears after you

你只出现在你之后的角色

  • backspace
  • backspace

(go ahead an try it on git bash).

(继续在 git bash 上尝试一下)。

So your link becomes ^?https://...

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

which is invalid.

这是无效的。

回答by TomDunning

Edit:This particular users problem was solved by starting a new terminal session.

编辑:这个特殊的用户问题是通过启动一个新的终端会话来解决的。

A ?before the protocol (https) is not support. You want this:

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

git clone [email protected]:octocat/Spoon-Knife.git

git clone [email protected]:octocat/Spoon-Knife.git

or this:

或这个:

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

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

Selecting the location to clone

选择要克隆的位置

回答by Aneel Khalid

Simple Answer is Just remove the https

简单的答案是删除https

Your Repo. : (git clone https://........)

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

just Like That (git clone ://.......)

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

and again type (git clone https://........)

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

Problem Solve 100%...

问题解决 100%...

回答by Konstantine Berulava

Just use double quotes with URL, like: git clone "https://yourRepoUrl"

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

(It somehow sees that you are using 2 quote marks on start, don't know why).

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

I was getting the same error => fatal: protocol ''https' is not supported(you can see 2 quote marks on https).

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

回答by gcb

There is something fishy going on. Probably a github bug that is not consistent (A/B testing?)

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

I am on windows10, using firefox. I have just copied a checkout URL and got an extra character. But only the first time. A second time it wasn't there. I had to look at my history file to see it!

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

here is my history:

这是我的历史:

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

the history command doesn't show the extra char. Just like it wasn't rendered when i was copy-pasting it into the terminal. You can see how i tried to remove the 's' and then the entire protocol? I was only triggered to investigate further when the backspace key moved one less character than i was expecting!

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

I saved my shell history file onto a machine with an hex editor and:

我将我的 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

There i a c2 96char inserted before the url. No idea what that is. Is it not extended ASCII (where it would be ?–) and it was hidden from almost every place i pasted while it was on the clipboard. The closest i've found with this hex value would be https://www.fileformat.info/info/unicode/char/c298/index.htmbut i didn't see the utf prefix anywhere (again, might have been lost)

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

This all might be misleading as I lost the page/clipboard and am working exclusively from the saved shell history file, which might very well be missing data from the original bug/malicious injection.

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

回答by Mukesh Kumar

Problem

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

问题

git clone https://github.com/rojarfast1991/TestGit.git致命:不支持协议“https”

Solution:

解决方案:

Steps:

脚步:

(1):- Open the new terminal and clone the git repository

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

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

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

(2) Automatic git login prompt will open and it will be asked you to enter a user credential.

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

UserName : - xxxxxxx

用户名 : - xxxxxxx

PassWord : - xxxxxxx

密码: - xxxxxxx

Finally, cloning will start...

最后,克隆将开始......

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.

回答by KARTHIKEYAN.A

Use httpinstead of https; it will give warning message and redirect to https, get cloned without any issues.

使用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.

回答by monday

I encountered the same problem after freshly installing git on Windows 10 and running it for the first time. Restarting the bash window solved the problem.

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

回答by Alara_stealth

I had the same problem, all I did was to restart the command line and then navigate to the document folder rather than the user folder using the command '' cd documents '' . That should be all thats needed. Also ensure that the link is correct.

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

回答by Mahendra Sirkar

You might be using a windows or linux computer where you have not logged into git hub so the certificate is not verified. From the sytem where you are getting error login to github with the credential then try to use the command it will work . Good Luck

您可能正在使用未登录到 git hub 的 windows 或 linux 计算机,因此未验证证书。从出现错误的系统使用凭据登录到 github,然后尝试使用它会起作用的命令。祝你好运