530

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:

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

Also tried with 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.

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

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

George
  • 6,886
  • 3
  • 44
  • 56
Hank Lin
  • 5,959
  • 2
  • 10
  • 17
  • 3
    Can you check if there are any strange special characters in the copied text. Maybe try typing the whole URL instead of copying it from github. And maybe also check if github.com really resolves to github or if there is something redirecting it to another server. – lw1.at Dec 31 '18 at 15:05
  • 1
    Or maybe some other software on your computer corrupted the intstalled git (see https://stackoverflow.com/questions/15553161/github-error-protocol-https-not-supported-or-disabled-in-libcurl). In that case reinstalling it might fix the issue. – lw1.at Dec 31 '18 at 15:06
  • 1
    If you are using GitHub Desktop or any other GUI Git software, make sure to only copy and paste the URL without git clone at the beginning. – Aarony Mar 16 '22 at 14:01

25 Answers25

1536

Problem is probably this.

You tried to paste it using

  • CTRL + V

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

  • Right Click - Paste**.

Sadly whenever you enter CTRL + V on terminal it adds

  • a hidden ^?

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

the character that you only appears after you

  • backspace

(go ahead an try it on git bash).

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

which is invalid.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
user11452886
  • 15,376
  • 2
  • 7
  • 2
  • 20
    But why does this happens? – champion-runner Oct 08 '19 at 07:25
  • 4
    That worked, thanks! I pasted it using right mouse button. Then, I placed cursor in the middle of "https" and pressed Backspace multiple times – Liker777 Nov 28 '21 at 06:05
  • 2
    If you are using GitHub Desktop or any other GUI Git software, make sure to only copy and paste the URL without git clone at the beginning. – Aarony Mar 16 '22 at 14:00
  • This worked for me, but why would this ever be a problem? – Lou Jul 08 '22 at 07:52
  • If anyone facing the issue in bitbucket source control, make sure the remote URLs has not invalid chars like spaces at beginning. – Deshan Sep 17 '22 at 17:31
  • Thank you very much for outlining this horrible gotcha for those of us that are not used to working on Windows. For @Lou and @champion-runner, this happened to me because I'm using a GitBash Msys terminal on Windows when I'm used to using streamlined Linux based tools. So I'm attempting all sorts of keystrokes like `CTRL-V` when instead `SHIFT-INS` would work and it's screwing up the input. It's pretty amazing how the Cygwin and Ming projects have ported so much of the important Linux stuff to Windows but there are some crazy workarounds and changes especially in regards to terminal behaviour. – NeilG Dec 02 '22 at 01:38
  • I'm glad this answer exists, there was no way I could have figured this out. – A. K. Mar 31 '23 at 17:52
  • Had the exact problem when attaching an AWS Code Commit Repo to my local project using Source Tree. As old as this answer is, it still saved me a lot of time. – Nantoka Jun 03 '23 at 15:47
  • `Ctrl` + `Ins` for copy and `Shift` + `Ins` for paste in Git Bash. – Nathaniel Jones Jul 24 '23 at 16:04
38

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

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

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

or this:

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

Selecting the location to clone

arthur.sw
  • 11,052
  • 9
  • 47
  • 104
TomDunning
  • 4,829
  • 1
  • 26
  • 33
  • Sorry I am not sure why the "?" appeared when I copied from the command line. I have edited my post. – Hank Lin Dec 31 '18 at 14:43
  • Try either of these commands for me, I don't know why you have a `.` after the `github.com/` but that's not right. – TomDunning Dec 31 '18 at 14:46
  • I tried with SSH as well and it didn't work. There is a "." in place of where my username is. – Hank Lin Dec 31 '18 at 14:47
  • Have you forked the project then? Did you make it public or private? If it's public, you should be able to copy the url from the box as shown above. If it's private you must have your private key added to your account. – TomDunning Dec 31 '18 at 14:50
  • 2
    Thank you- I restarted the command line and for some reason now it works. I am still very confused why it didn't work to begin with. – Hank Lin Dec 31 '18 at 17:04
  • 1
    I also solved the problem opening a new command line. I checked the option to open Git Bash when installing Git and used that to git clone the first time. That may be the cause. – Detached Laconian Apr 12 '19 at 01:10
  • 2
    Restarting my terminal fixed the issue – Elkas May 13 '19 at 09:43
  • Happened to me and discovered I had a special char before https – Alessandro L. Aug 08 '19 at 12:12
23

Simple Answer is just remove the https

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

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

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

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Aneel Khalid
  • 247
  • 2
  • 5
17

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

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

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

skillsmuggler
  • 1,862
  • 1
  • 11
  • 16
10

If you are using Visual Studio or Git GUI to clone you need to remove the "git clone" command. Only the address is needed.

Bojan
  • 769
  • 9
  • 16
8

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

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!

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!

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

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 96 char 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.htm but i didn't see the utf prefix anywhere (again, might have been lost)

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.

gcb
  • 13,901
  • 7
  • 67
  • 92
  • I can confirm this is similar to what was happening to me, some strange char was added (invisibly) when pasting into gitbash on windows – Arruda Jul 08 '22 at 18:46
5

Copy from plain notepad:

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

and then paste it in cmd.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Ramesh
  • 1,829
  • 2
  • 25
  • 30
3

Problem

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

Solution:

Steps:

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

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.

UserName : - xxxxxxx

PassWord : - 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.
Community
  • 1
  • 1
3

I got an error that looked very similar to this because I put single-quotes around the URL:

fatal: protocol ''https' is not supported

Removing the single-quotes from the URL fixed the problem.

James Douglas
  • 3,328
  • 2
  • 22
  • 43
2

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

$ 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.
jpp
  • 159,742
  • 34
  • 281
  • 339
KARTHIKEYAN.A
  • 18,210
  • 6
  • 124
  • 133
2

If you are using a Git Bash:

Do not paste the link by pressing Ctrl + V.
You can just type git clone the right click then paste.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Jericho Manalo
  • 646
  • 6
  • 4
1

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.

michalmonday
  • 441
  • 5
  • 11
1

You tried this:

Ctrl + V

Just right click and click on paste

Nimantha
  • 6,405
  • 6
  • 28
  • 69
1

I got this error when I was trying to be smart and extract the cloning URL from the repo's URL myself. I did it wrong. I was doing:

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

where I had to do:

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

I had 3 mistakes:

  • didn't need https://
  • after .com I need : instead of /
  • at the end I need a .git
mfaani
  • 33,269
  • 19
  • 164
  • 293
1

This issue persisted even after the fix from most upvoted answer.

More specific, I pasted in the link without "Ctrl + v", but it still gave fatal: protocol 'https' is not supported.

But if you copy that message in Windows or in Google search bar you will that the actual message is fatal: protocol '##https' is not supported, where '#' stands for this character. As you can see, those 2 characters have not been removed.

I was working on IntelliJ IDEA Community Edition 2019.2.3 and the following fix refers to this tool, but the answer is that those 2 characters are still there and need to be removed from the link.

IntelliJ fix

Go to top bar, select VCS -> Git -> Remotes... and click.

Now it will open something link this

enter image description here

You can see those 2 unrecognised characters. We have to remove them. Either click edit icon and delete those 2 characters or you can delete the link and add a new one.

Make sure you have ".git" folder in your project folder.

enter image description here

And now it should like this. Click "Ok" and now you can push files to your git repository.

enter image description here

Gabriel Arghire
  • 1,992
  • 1
  • 21
  • 34
1

Just add this git config --global http.sslVerify false , so that it doesn't check the certificate.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
1

enter image description here

People commonly click the copy button in Github or Bitbucket and paste it on the "Clone a repository" page in Visual Studio.

You need to remove the "git clone " command from in front of what you have copied. Just paste the URL starting with "https://....". Then it should work.

Otherwise, you will get the https not supported message.

1

In my case, the pushurl had a space character at the beginning (.git\config file)

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

Removed it and the problem was solved.

maXer
  • 176
  • 6
0

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.

cs95
  • 379,657
  • 97
  • 704
  • 746
saas_joel
  • 320
  • 3
  • 11
0

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 system where you are getting error login to GitHub with the credential then try to use the command it will work.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
0

I have tried a lot of ways to solve this. But I am failed again and again. Then I did this:

Open Git Bash > go to your directory > paste the git clone https://shahadat@bitbucket.org/*******.git after that a command prompt will be shown to give the login credentials. Give the credentials and clone your project.

Shahadat Hossain
  • 533
  • 7
  • 20
0

I got this error when I was trying to clone through Visual Studio. When I did the same thing in PowerShell, it worked just fine.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Preza8
  • 400
  • 1
  • 3
  • 13
0

UPLOAD PROJECT TO 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
0

Had the same issue on my brand new Ubuntu server, then I realized that I don't have net-tools installed on my system.

First run sudo apt install net-tools
Then to update your system sudo apt update

Now try to open port 80 using nginx which can be installed using sudo apt install nginx and to open port 80 run sudo ufw allow 'Nginx HTTP'.

Same goes for port 8080 for https run sudo ufw allow 'Nginx HTTPS'

Try to reboot your system and now try to clone the repo.

0

For git fetch-pack, only git:// is supported:

https://public-inbox.org/git/873764bwjd.fsf@linux-m68k.org/T/

Tom Hale
  • 40,825
  • 36
  • 187
  • 242