Friday, June 26, 2020

Git Tips - How to know the remote repository URL of your local Branch

If you want only the remote URL, or referential integrity has been broken: 
git config --get remote.origin.url 

If you require full output or referential integrity is intact: 
git remote show origin 
When using git clone (from GitHub, or any source repository for that matter) the default name for the source of the clone is "origin". Using git remote show will display the information about this remote name. The first few lines should show:
C:\Users\jaredpar\VsVim> git remote show origin
* remote origin
Fetch URL:
Push URL: 
HEAD branch: master
Remote branches:

If you want to use the value in the script, you would use the first command listed in this answer.


Post a Comment


Get in touch with me


Bangalore, India