Why I Bother With This
I got tired of opening the browser every time I wanted to create a repo, check a PR, or trigger a workflow. GitHub CLI (gh) lets me do most of that from the terminal. Personal Access Tokens (PATs) are how Git authenticates when you push over HTTPS.
This post covers both — how I generate a PAT and how I use gh day to day.
Creating a Personal Access Token (PAT)
A PAT is basically a password for the command line.
- GitHub → profile photo → Settings
- Developer settings → Personal access tokens
- Generate new token
- Give it a name you’ll recognize later
- Set an expiration date
- Check repo (and any other scopes you need)
- Generate token — copy it now, you won’t see it again
Treat it like a password. Don’t commit it to a repo or paste it in chat.
Install GitHub CLI
Arch Linux:
sudo pacman -S github-cli
Or via AUR:
yay -S github-cli
Ubuntu:
sudo apt update
sudo apt install gh
Check:
gh --version
Log In
gh auth login
Follow the prompts — I usually pick GitHub.com, HTTPS, and browser login.
Confirm:
gh auth status
Commands I Actually Use
Repos
gh repo create my-repo --public
gh repo clone username/repository
gh repo fork username/repository
Issues and PRs
gh issue list
gh issue create --title "Bug Report" --body "What went wrong"
gh pr list
gh pr merge 123 --squash --delete-branch
GitHub Actions
gh run list
gh workflow run workflow-name.yml
gh run view --log
Git + gh Together
I still use plain Git for commits and pushes. gh handles the GitHub-specific stuff.
git clone https://github.com/username/repository.git
cd repository
git add .
git commit -m "Initial commit"
git push origin main
Then open a PR without leaving the terminal:
gh pr create --title "New feature" --body "What this changes"
Bottom Line
PAT for auth, gh for GitHub tasks, Git for everything else. That’s my setup and it saves me a lot of clicking.