When you are working in some Git directory, how can you get the Git repository name in some Git repository? Are there any Git commands?
# I did check out bar
In general, you cannot do this. Git does not care how your git repository is named. For example, you can rename directory containing your repository (one with .git
subdirectory), and git will not even notice it - everything will continue to work.
However, if you cloned it, you can use command:
git remote show origin
to display a lot of information about original remote that you cloned your repository from, and it will contain original clone URL.
If, however, you removed link to original remote using git remote rm origin
, or if you created that repository using git init
, such information is simply impossible to obtain - it does not exist anywhere.