Created
December 1, 2016 07:46
-
-
Save umireon/c066a8213c5cfa39ae6bdbe1616c986b to your computer and use it in GitHub Desktop.
Extract the user name and repository name on GitHub from `origin`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REPOURL=$(git remote get-url origin | grep '^https://github.com') || { | |
echo error: origin is not on github | |
exit 1 | |
} | |
GITHUB_USER=${REPOURL#https://*/} | |
GITHUB_USER=${GITHUB_USER%/*} | |
GITHUB_REPO=${REPOURL#https://*/*/} | |
GITHUB_REPO=${GITHUB_REPO%.git} | |
echo $GITHUB_USER $GITHUB_REPO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment