Create a GitHub repository via the API using a Personal Access Token (PAT), then push your local repo over SSH with the correct git@github.com:OWNER/REPO.git remote.
- Rust toolchain and Cargo installed (https://rustup.rs)
- Git installed with working SSH auth to GitHub (e.g.
ssh -T git@github.com) GITHUB_TOKENin your environment withreposcope
- From this checkout:
cargo install --path . - Can also install directly from GitHub:
- SSH:
cargo install --git ssh://git@github.com/tucker-weed/gh-repo-create-cli.git - HTTPS:
cargo install --git https://github.com/tucker-weed/gh-repo-create-cli.gitThe binary will be placed in~/.cargo/bin(ensure that directory is on yourPATH).
- SSH:
export GITHUB_TOKEN=ghp_yourtokenhere
gh-repo-create <repo-name> [--private] [--org ORG_NAME]# Public repo in your user account
gh-repo-create-cli prompt-graph-tools
# Private repo
gh-repo-create-cli prompt-graph-tools --private
# Repo under an org
gh-repo-create-cli prompt-graph-tools --org my-org-name- Creates a folder named after the repo and writes
README.mdwith a header. - Runs
git init, stages files, and commits "Initial commit". - Calls the GitHub API with your PAT to create the repo (user or org) and reads the returned
ssh_url. - Adds
originusing that SSH URL, renames the branch tomain, and pushesmainover SSH.
If anything fails, the CLI exits with the GitHub error body or the failing git command.