git,

How to get Git repository URL

Sep 07, 2022 · 1 min read · Post a comment

In this plain and simple tutorial we are going to see how to get the remote URL that a Git repository was initially cloned from. This could be useful though when writing scripts per se.

Prerequisites

  • Git

Solution

Step 1. Open terminal and run the following command:

git config --get remote.origin.url

Example output:

https://github.com/devcoops/devcoops.com.git

If you need more details, run:

git remote show origin

Conclusion

To find more neat Git commands and hacks, browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.

git