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
I was looking for same information in order to customize my shell prompt, so I decided to give a try and ended up with this command which output just the name of the project:
$ git config --local remote.origin.url|sed -n 's#.*/\([^.]*\)\.git#\1#p'
It should works in any case if your remote origin url is SSH, HTTPS with DNS or IP based.
If you don't have remote configured, only a local repository and your top level folder is the name of the project you can use git rev-parse and basename inside your git tree (not reliable solution). It will output the project name:
TOP=$(git rev-parse --show-toplevel); echo ${TOP##*/}
NB: GH doesn't allow you to clone using IP directly on HTTPS because certificate chain validation. It was just to illustrate the use cases.