Skip to content

Instantly share code, notes, and snippets.

@ScottJWalter
Created August 7, 2025 10:54
Show Gist options
  • Save ScottJWalter/4d62880ee03ce36d322eb173ed7f0eca to your computer and use it in GitHub Desktop.
Save ScottJWalter/4d62880ee03ce36d322eb173ed7f0eca to your computer and use it in GitHub Desktop.
create upstream repo from current folder
# create upstream repo from current folder
# optional params allow for alternate repo name, private repo, and auto-push (in order)
export GITHUB_AUTO_PUSH="--push"
gh repo create [alternate-upstream-name] [--private] --source=. --remote=${GITHUB_DEFAULT_REMOTE:-origin} ${GITHUB_AUTO_PUSH:-[--push]
git config --global alias.ghcreate '!f() {
REPO_NAME=${1:-$(basename $(pwd))}
REMOTE_NAME=${2:-origin}
VISIBILITY=${3:-private}
if [ "$VISIBILITY" = "public" ]; then
gh repo create "$REPO_NAME" --public --source=. --remote="$REMOTE_NAME" --push
else
gh repo create "$REPO_NAME" --private --source=. --remote="$REMOTE_NAME" --push
fi
}; f'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment