Skip to content

Instantly share code, notes, and snippets.

@tadd
Last active January 31, 2023 16:39
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 tadd/711a1f04cd89e488fb08ef562e045f43 to your computer and use it in GitHub Desktop.
Save tadd/711a1f04cd89e488fb08ef562e045f43 to your computer and use it in GitHub Desktop.
Generate shortcut urls for .gitconfig
# Usage: sh gen-git-pushj-instead-of.sh github.com-name [gitlab.com-name] >>~/.gitconfig
# Then:
# git clone gist:711a1f04cd89e488fb08ef562e045f43 # or
# git clone gh:ruby/ruby
_url()
{
printf "[url \"git@$2:${3:+$3/}\"]\n\tinsteadOf = $1:\n"
}
gh=github.com
gl=gitlab.com
usergh=$1
usergl=${2:-$1}
_url gh $gh
_url gh-me $gh $usergh
_url gl $gl
_url gl-me $gl $usergl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment