Git is a powerful version control system widely used in the software development world. When working with Git repositories, it’s essential to have a clear understanding of the repository’s origin. Sometimes, you may have cloned a Git repository from GitHub, but over time, you forget which specific fork or user you cloned it from. In this article, we’ll discuss how to determine the URL that a local Git repository was originally cloned from, which can be particularly useful when you’re dealing with forks on GitHub.

The Problem

Imagine you’ve cloned a Git repository from GitHub that has several forks or contributors. You’ve been working on your local copy of the repository for some time, but now you’re uncertain which fork you originally cloned. This can be a common scenario, especially when you work on multiple projects and collaborate with various developers.

Determining the original URL or repository from which your local copy was cloned can help you:

  1. Identify the primary source of the project.
  2. Keep your local repository in sync with updates from the upstream repository.
  3. Contribute back to the original project by submitting pull requests.

Let’s explore the solution to this problem.

The Solution

To find the original URL of the Git repository from which your local copy was cloned, you can use the git remote command. The git remote command provides a list of remote repositories associated with your local Git project.

Here’s a step-by-step guide on how to do it:

Step 1: Open Your Terminal

First, open your terminal or command prompt.

Step 2: Navigate to Your Local Repository

Use the cd command to navigate to the directory where your local Git repository is located.

cd path/to/your/local/repo

Step 3: List Remote Repositories

Use the following command to list the remote repositories associated with your local Git repository:

git remote -v

This command will display a list of remote repositories along with their URLs. The URLs are typically labeled as origin and upstream.

  • The origin URL is the one you originally cloned your repository from.
  • The upstream URL, if present, can be used to track the primary source of the project for updates and contributions.

The URL listed as origin is the answer to your question; it’s the URL of the repository you initially cloned.

Example Output

Here’s an example of what the output might look like:

origin  https://github.com/yourusername/repo.git (fetch)
origin  https://github.com/yourusername/repo.git (push)
upstream  https://github.com/originaluser/repo.git (fetch)
upstream  https://github.com/originaluser/repo.git (push)

In this example, the origin URL points to your fork of the repository, and the upstream URL is the original repository from which you forked.

By following these steps, you can easily determine the URL that your local Git repository was originally cloned from.


Knowing the URL of the original repository is crucial for effective collaboration and keeping your local copy up to date. Git’s git remote command provides a simple solution to this problem, allowing you to identify the source of your cloned repository. This knowledge empowers you to work more efficiently with Git, especially when collaborating on open-source projects or working with multiple forks.

Microsoft MVP

Chris Pietschmann is a Microsoft MVP, HashiCorp Ambassador, and Microsoft Certified Trainer (MCT) with 20+ years of experience designing and building Cloud & Enterprise systems. He has worked with companies of all sizes from startups to large enterprises. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.
HashiCorp Ambassador Microsoft Certified Trainer (MCT) Microsoft Certified: Azure Solutions Architect