If you’ve cloned a fork of a Github repository, it might have the same name as many other forks. Which one did you pull from? Rather than digging through your browser history, you can use Git’s built in tools to view the URL it’s connected to.
This Doesn’t Work For “Download ZIP”
Note: if you’ve downloaded a Git repo using the “Download ZIP” button, you won’t be able to view the remote URL. You will have to search for “github.com” in your browser history, and compare the latest commits.
This is because downloading a ZIP from Github comes disconnected from Git, and without any Git history at all. In most cases, you will want to clone the repository properly. If you’re unsure, check for a hidden .git folder in your repository. Otherwise, all commands will fail, because it isn’t set up as a Git repo.
Getting The Remote URL For a Git Repository
Git stores remote URLs in objects called “remotes,” which track the fetch/push URL as well as all of the remote branches, which are usually set up with git pull and git push to use your local branches.
You can get all the information about a remote, including the configured URL, using remote show:
origin is the default for almost all repositories, but it may be named something else. If you’re unsure what the remote is called, simply run “git remote,” which will print all of them.
This requires you to be online and authenticated with Github. If you want to fetch the URL offline, you can also get it from Git’s config system, or from the newer command remote get-url: