Why click around in a browser when you can control GitHub like a true Linux wizard? The GitHub CLI lets you create repos, push code, and manage pull requests — all without leaving the terminal. Follow these steps to set it up and make your workflow faster.
1. Install Git and GitHub CLI
For Arch-based systems:
sudo pacman -S git github-cli
2. Configure Git with Your GitHub Identity
Replace name
and email
with your actual GitHub username and email:
git config --global user.name "name"
git config --global user.email "email"
Verify settings:
git config --global --list
3. Authenticate with GitHub
Run the login command:
gh auth login
Choose:
- GitHub.com
- HTTPS
- Login with a web browser
You’ll see an 8-digit code. Copy it, press Enter, and follow the GitHub page in your browser to approve access.
Check login status:
gh auth status
4. Initialize Git in Your Project
Navigate to your project folder and initialize git:
cd /path/to/project
git init
5. Create a GitHub Repository from Terminal
Replace repo_name
with your preferred repository name:
gh repo create repo_name --public --source=.
6. Link Your Local Repo to Remote
Replace your-github-account
and repo_name
:
git remote set-url origin https://github.com/your-github-account/repo_name
7. Push Your Code to GitHub
Run the commands in order:
git add .
git commit -m "first commit"
git branch -M main
git push -u origin main
Done! You now have a fully working GitHub setup — powered entirely from the terminal. No mouse clicks, no distractions — just pure CLI productivity.