When you do your first clone using the syntax
git clone username@server:gitRepo.git
Is it possible using your local repository to find the name
I stumbled on this question trying to get the organization/repo string from a git host like github or gitlab.
This is working for me:
git config --get remote.origin.url | sed -e 's/^git@.*:\([[:graph:]]*\).git/\1/'
It uses sed to replace the output of the git config command with just the organization and repo name.
Something like github/scientist would be matched by the character class [[:graph:]] in the regular expression.
The \1 tells sed to replace everything with just the matched characters.