Skip to content

Instantly share code, notes, and snippets.

@jcrist
Created April 30, 2019 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcrist/c69f55dc7df7fc9cdcaae32375fcc4ee to your computer and use it in GitHub Desktop.
Save jcrist/c69f55dc7df7fc9cdcaae32375fcc4ee to your computer and use it in GitHub Desktop.
Add a remote github user account for the current repo
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
}
@jcrist
Copy link
Author

jcrist commented Apr 30, 2019

Intended to be put in your .bashrc. Usage:

$ github-remote-add jcrist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment