Created
April 30, 2019 21:12
-
-
Save jcrist/c69f55dc7df7fc9cdcaae32375fcc4ee to your computer and use it in GitHub Desktop.
Add a remote github user account for the current repo
This file contains 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-remote-add () { | |
case $1 in | |
""|--help|-h) | |
echo "Usage: github-remote-add USERNAME" | |
return 1 | |
;; | |
esac | |
local root=`git rev-parse --show-toplevel`; | |
if [ $? -ne 0 ]; then | |
echo "Not in a git directory" | |
fi | |
local repo=`basename $root` | |
git remote add $1 "git@github.com:$1/$repo.git"; | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Intended to be put in your
.bashrc
. Usage: