- Published at
Creating GitHub Repositories from CLI

Quickly create a GitHub repository from the command line
Table of Contents
Picture this: You’ve just built a weather dashboard and want to share it with the world. Let’s learn how to create a GitHub repository straight from your terminal.
Prerequisites
# Install GitHub CLI# macOSbrew install gh
# Windowswinget install GitHub.cli
Quick Setup
Navigate to your project:
cd ~/projects/weather-dashboard
Initialize Git:
git initgit add .git commit -m "First forecast: Initial commit"
Authenticate with GitHub:
gh auth login
Create and push your repository:
gh repo create weather-wizard --public --source=. --push
Command Breakdown
Let’s analyze that last command:
weather-wizard
: Repository name--public
: Makes it visible to everyone--source=.
: Uses current directory--push
: Uploads files automatically
Advanced Options
Add metadata:
gh repo create climate-tracker \ --description "Real-time weather monitoring dashboard" \ --homepage "https://weather-app.example.com" \ --public --source=. --push
Create with license:
gh repo create forecast-pro --license "mit" --public --source=. --push
Troubleshooting
Common issues:
- Repository names must use hyphens instead of spaces
- For private repos, swap
--public
with--private
- Conflicts? Use
--remote-name origin
Final Thoughts
GitHub CLI transforms repository creation into a streamlined process. No more context switching between terminal and browser - just efficient, focused development.
Written for folks who value their time