This must be something basic but I can't figure it out. I have a github URL that has the form "". How do I download the contents? In response to
git clone
I get
fatal: repository ' not found
When I do
git clone
I get the contents of the root folder but not the subfolder that I want.
What am I doing wrong?
41 Answer
A GitHub HTTPS URL is of the form , with an optional .git on the end. The URL you're using, with /tree/main, is designed to render the main branch in the user interface, but that isn't a valid repository and you can't use it with Git.
If it's the case that you want to look at the main branch in the repository, then clone it using a proper URL, and then run git checkout -b main origin/main, which will create a main branch that's a copy of the remote branch. If you're already on the branch main, then that won't work, and you can just look at the repository once it's cloned.