Skip to content

Instantly share code, notes, and snippets.

@enten
Last active April 3, 2018 13:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enten/0ece8e63282376e2a2df to your computer and use it in GitHub Desktop.
Save enten/0ece8e63282376e2a2df to your computer and use it in GitHub Desktop.
Print Github username/repository from the current remote branch
REPO=git remote -v | grep -e push | awk '{print $2}' | sed 's/https:\/\/github.com\///g' | sed 's/.git//g'
REPOUSER=$(echo $REPO | awk -F '/' '{print $1}')
REPONAME=$(echo $REPO | awk -F '/' '{print $2}')
echo "https://$REPOUSER.github.io/$REPONAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment