Personally, I never liked switching back and forth between my browser and terminal when working with git repos on GitHub. For this reason, I was excited to hear about the new GitHub CLI.
Installing GitHub CLI 1.0 (beta)
brew install gh
sudo port install gh
If you have Homebrew installed, you can simply use:
brew install gh
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo dnf install gh
sudo zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo
sudo zypper ref
sudo zypper install gh
download the tar from https://github.com/cli/cli/releases/tag/v1.0.0
I will be using Homebrew on WSL Ubuntu for my setup. Follow the appropriate installation instructions from the step above, and you should have the same results.
You must connect to your GitHub account to start using the CLI.
gh auth login to start connecting your account.
GitGub.com and then select
Paste an authentication token
Follow the link to get your token: https://github.com/settings/tokens , generate a new token, and paste it into the terminal.
Now select your protocol, I use SSH.
gh auth status to make sure you are logged in.
Creating a New Repo
To create a repo run
gh repo your-repo-name
Optionally, you can use flags, for example the
-d flag sets the repo’s description.
You will need to tell git where to push for your first push.
Cloning a Repo
gh repo clone <repo>
You can clone a repo using the owner/repo syntax. For example, to clone the repo that I just created, you would use
gh repo clone sPesce/my-descriptive-repo . For this example, I will clone the GitHub CLI repo.