Created
December 7, 2025 23:20
-
-
Save schutzsmith/6d3b3ada1d307106efa552489cb68420 to your computer and use it in GitHub Desktop.
GitHub repository creation alias for zshrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GitHub repository creation alias | |
| function create_github_repo() { | |
| echo "Enter repository name:" | |
| read repo_name | |
| gh repo create "$repo_name" --private | |
| # Get the GitHub username from gh cli | |
| github_username=$(gh api user | grep login | cut -d'"' -f4) | |
| git init | |
| # gh auth login | |
| git add . | |
| git commit -m "Initial commit" | |
| git branch -M main | |
| git remote add origin "[email protected]:$github_username/$repo_name.git" | |
| git push -u origin main | |
| git status | |
| echo "Repository $repo_name created and initialized successfully!" | |
| } | |
| alias ghcreate='create_github_repo' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment