Getting "fatal: repository not found" when "git clone" a URL

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?

4

1 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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like