GitHub CLI is a command-line tool for interacting with GitHub without leaving the terminal.
brew install ghtype -p curl >/dev/null || sudo apt install curl
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg |
sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /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 ghgh auth loginRuns an interactive setup to log into your GitHub account using HTTPS or SSH.
gh repo clone user/repo # Clone a repo
gh issue list # List issues
gh pr list # List pull requests
gh pr create # Create a new pull request
gh pr checkout 123 # Checkout PR by number
gh auth status # Check login statusIf you're using gh to manage repos, don't forget to configure .gitignore properly.
echo "node_modules" >> .gitignore
echo ".env" >> .gitignore
git add .gitignore
git commit -am ".gitignore added"
git push- Use
gh repo forkto fork a repository. - Use
gh pr createto open a pull request from your fork.
π§ Use gh help to see all available commands.