This post will discuss determining the URL from which a local Git repository was originally cloned.
How to Determine the URL that a Local Git Repository was Originally Cloned from?
To determine the URL from which a local Git repository was originally cloned, different commands are available for this purpose, such as:
- “$ git config –get remote.origin.url”
- “$ git remote -v”
- “$ git remote show origin”
Now, let’s move ahead and utilize the above-discussed commands to determine the remote repository URL!
How to Determine the URL Using “git config” Command?
The “$ git config” command can determine the URL from which a local Git repository was cloned. To do so, follow the below-listed steps.
Step 1: Git Repository
First, navigate to the Git directory where the desired repository is located:
Step 2: Obtain URL
Execute the “git config –get” command with the “remote.origin.url” to get the remote repository URL:
How to Determine the URL Using “git remote -v” Command?
Another way to determine the URL that a local Git repository was originally cloned is by utilizing the “git remote” command:
Here, the “-v” option is used to view the list of remote connections:
How to Determine the URL Using “git remote show origin” Command?
The “git remote show origin” is also used to view the remote repository URL:
As you can see in the below-given output, the remote repository URL is displayed:
That’s all! We have provided multiple commands to determine the URL from which a local Git repository was originally cloned.
Conclusion
To determine the URL that a local Git repository was originally cloned from, there are different commands available for this purpose, such as “$ git config –get remote.origin.url”, “$ git remote -v”, and “$ git remote show origin” commands. This post illustrated the procedure to determine the URL from which a Git local repository was originally cloned.