Currently my organization uses ssh instead of https for Bitbucket. So when one does a
git remote get-url origin
It returns something like…
git@bitbucket.org:myorg/myrepo.git
I would like to create an alias that replaces the git@bitbucket.org: with https://bitbucket.org/ to show what the https url would be.
Something like
rr = "!f() { ref=$(git remote get-url origin); echo $ref; }; f"
Except where the echo $ref is, it should do the above replacement instead. I just can’t seem to find a good example of doing this sort of string replacement for a git alias function.
>Solution :
replace the : and then the git@
git remote get-url origin|sed 's!:!/!g'| sed 's!^git@!https://!g'