Last active
April 18, 2017 17:34
-
-
Save tyrelsouza/92af587363424b3051b30105ee7a8928 to your computer and use it in GitHub Desktop.
Modified form of https://dev.to/shayde/open-the-github-project-page-of-a-repo-from-terminal to get ssh urls also
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
function GitHub() | |
{ | |
if [ ! -d .git ] ; | |
then echo "ERROR: This isnt a git directory" && return false; | |
fi | |
git_url=`git config --get remote.origin.url` | |
if [[ $git_url == https://github* ]]; | |
then | |
url=${git_url%.git} | |
else | |
if [[ $git_url == [email protected]* ]] | |
then | |
url="https://github.com/${${git_url:15}%.git}" | |
else | |
echo "ERROR: Remote origin is invalid" && return false; | |
fi | |
fi | |
open $url | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment