GitHub CLI for Content and Code: A Quick Primer
GitHub CLI (gh) transforms how you interact with GitHub from the command line. Instead of switching between browser tabs and terminals, you can manage repositories, issues, pull requests, and more directly from your terminal. For SEO professionals and developers, this means faster workflows and better automation capabilities.
Installation and Setup
Install GitHub CLI on macOS using Homebrew, or download directly from GitHub:
# macOS
brew install gh
# Windows (via winget)
winget install GitHub.cli
# Linux (Ubuntu/Debian)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
Authenticate with your GitHub account:
gh auth login
Choose your preferred protocol (HTTPS or SSH), authentication method (web browser or token), and follow the prompts. The CLI will store your credentials securely for future use.
Repository Management
Create and manage repositories without leaving your terminal:
# Create a new repository
gh repo create my-seo-site --public --source=. --remote=origin --push
# Clone a repository
gh repo clone username/repository-name
# View repository information
gh repo view username/repository-name
# Fork a repository
gh repo fork username/repository-name --clone
Issue and Pull Request Workflow
Streamline your development workflow with integrated issue and PR management:
# Create an issue
gh issue create -t "Content update needed" -b "Refresh SEO blog titles for better CTR"
# List issues
gh issue list --state open
# Create a pull request
gh pr create -t "Add new blog post" -b "Adds comprehensive Cloudflare CLI guide" -B main -H feature-branch
# Review and merge PRs
gh pr list
gh pr view 123
gh pr merge 123 --squash --delete-branch
Advanced Automation for SEO Workflows
For SEO professionals, GitHub CLI becomes powerful when combined with automation scripts:
#!/bin/bash
# Automated blog post creation workflow
# Create new branch
BRANCH_NAME="blog/$(date +%Y-%m-%d)-new-seo-topic"
gh repo create-branch $BRANCH_NAME
# Create issue for content planning
gh issue create -t "Content: New SEO Topic" -b "Research and write comprehensive guide on [topic]"
# Create PR template
gh pr create -t "Add: New SEO Blog Post" -b "## Summary
- [ ] Content research completed
- [ ] SEO optimization applied
- [ ] Images optimized
- [ ] Internal linking added
- [ ] Meta descriptions written"
Integration with Cloudflare Pages
Deploy static sites automatically when merging to main:
# Set up automatic deployment
gh workflow enable "pages deploy"
# Manual deployment trigger
gh api repos/:owner/:repo/actions/workflows/pages.yml/dispatches \
--method POST \
-f ref=main
Content Management Workflows
For managing blog content and SEO assets:
# Bulk create issues for content planning
gh issue create -t "Q1 Content: Technical SEO Audit Guide" -b "Comprehensive technical SEO audit checklist and implementation guide"
gh issue create -t "Q1 Content: Local SEO Strategy" -b "Complete local SEO strategy for small businesses"
gh issue create -t "Q1 Content: Core Web Vitals Optimization" -b "Step-by-step Core Web Vitals improvement guide"
# Create project board for content planning
gh project create --title "2025 Content Calendar" --body "SEO blog content planning and execution"
# Add issues to project
gh project item-add 1 --owner username --repo repository --number 123
Collaboration and Team Workflows
Enhance team collaboration with GitHub CLI:
# Assign issues to team members
gh issue edit 123 --add-assignee @me
gh issue edit 123 --add-assignee username
# Add labels and milestones
gh issue edit 123 --add-label "content,seo,high-priority"
gh issue edit 123 --milestone "Q1-2025"
# Review team activity
gh api repos/:owner/:repo/issues --jq '.[] | select(.assignee.login == "username")'
API Integration and Custom Scripts
Leverage GitHub's API for custom SEO tools and automation:
# Get repository statistics
gh api repos/:owner/:repo/stats/contributors
# Create automated SEO reports
gh api repos/:owner/:repo/issues --jq '.[] | {title: .title, created: .created_at, labels: [.labels[].name]}' > seo-content-report.json
# Monitor repository activity
gh api repos/:owner/:repo/activity --jq '.[] | select(.type == "PushEvent") | {author: .actor.login, message: .payload.commits[0].message}'
Best Practices for SEO Teams
-
Consistent Branch Naming: Use descriptive branch
names like
content/blog-post-titleorseo/optimize-meta-tags - Issue Templates: Create issue templates for content requests, SEO audits, and technical improvements
- Automated Checks: Set up GitHub Actions to validate content, check for broken links, and run SEO audits
- Documentation: Use GitHub Wiki or README files to document SEO processes and guidelines
Troubleshooting Common Issues
If you encounter authentication issues:
# Re-authenticate
gh auth logout
gh auth login
# Check authentication status
gh auth status
# Refresh token
gh auth refresh
For repository access issues:
# Check repository permissions
gh api repos/:owner/:repo/collaborators/:username/permission
# Verify SSH key setup
gh ssh-key list
Integration with Other Tools
GitHub CLI works seamlessly with other development tools:
- VS Code: Use the GitHub Pull Requests extension for integrated PR management
- Git: GitHub CLI extends Git with GitHub-specific features
- CI/CD: Trigger GitHub Actions workflows from the command line
- Monitoring: Integrate with tools like Sentry or DataDog for automated issue creation
By mastering GitHub CLI, you can significantly speed up your content creation and SEO workflow, making it easier to manage multiple projects, collaborate with team members, and maintain consistent processes across your organization.