Skip to content

Instantly share code, notes, and snippets.

@jcrist
Created April 30, 2019 21:12
Show Gist options
  • Select an option

  • Save jcrist/c69f55dc7df7fc9cdcaae32375fcc4ee to your computer and use it in GitHub Desktop.

Select an option

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

jcrist commented Apr 30, 2019

Copy link
Copy Markdown
Author

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