Skip to content

Instantly share code, notes, and snippets.

@umireon
Created December 1, 2016 07:46
Show Gist options
  • Select an option

  • Save umireon/c066a8213c5cfa39ae6bdbe1616c986b to your computer and use it in GitHub Desktop.

Select an option

Save umireon/c066a8213c5cfa39ae6bdbe1616c986b to your computer and use it in GitHub Desktop.

Revisions

  1. umireon created this gist Dec 1, 2016.
    12 changes: 12 additions & 0 deletions github_user_repo_from_git.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    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