Python's os.path.basename, basename from coreutils and busybox's basename all do the "right thing" with your example string.
On my systems, running 1.6.2.3, I'd use `git config --get remote.origin.url' to get for example "git@github.com:JNRowe/misc-overlay.git"
Comment
I think I know what you mean but the whole string starts with "== Remote URL: " which means that basename fails on it.
$ repo_name=`git info | head -n1`
$ basename $repo_name
basename: extra operand `URL:'
Try `basename --help' for more information.
Parent comment
Python's os.path.basename, basename from coreutils and busybox's basename all do the "right thing" with your example string. On my systems, running 1.6.2.3, I'd use `git config --get remote.origin.url' to get for example "git@github.com:JNRowe/misc-overlay.git"
Replies
My fault, I should have used an example.
basename "$repo_name"
it is the quoting that is important, it makes basename treat the string as an ugly space and symbol including filename