Does git have a built-in command for showing the name of the current remote project? Right now I\'m using this:
git remote -v | head -n1 | awk \'{print $2}\' | s
The command git remote -v
can not be assumed as reliable because your repository can work with more than one remote repositories. For example, your project is your-project
and you have added another-project
. After the command you are expecting to see the name of your project but you'll see the name of another project:
$ git remote -v | head -n1
ABC https://git.team1.ourcompany.com/another-project.git (fetch)
ABC https://git.team1.ourcompany.com/another-project.git (push)
origin https://git.ourcompany.com/your-project.git (fetch)
origin https://git.ourcompany.com/your-project.git (push)
What I could suggest is to check your repository's configuration, for example:
$ git config --local remote.origin.url
https://git.ourcompany.com/your-project.git
In the first approach this is the more reliable but doesn't give 100% insurance.