How To: Git and GitHub

HIGHLY RECOMMENDED TO GET AND USE THE GITHUB CLI + VSCODE!!!

INSTALL GIT

Make sure you have git installed.

 $ git --version

^ Run on Mac, if not installed, it will prompt you to install it.

To install on Debian based linux: 

$  sudo apt install git-all

Now continue to below to install GitHub CLI.

INSTALL GH CLI

  • Open Terminal
  • Install gh cli

Mac:

$ brew install gh

Win:

Hopefully you have WSL/Ubuntu.

Linux:

sudo apt install gh

SETUP GH CLI + Authorize Your GitHub Account

  • Run:
$ gh auth login
  • SELECT FOLLOWING OPTIONS (using arrow keys and enter):
    • Where Github? = GitHub.com
    • Choose HTTPS
    • Type Y / Yes
    • Login with a web browser
    • Copy the code it gives you!
    • Press enter
  • Auth on browser (paste the code it gave you) in GitHub (use correct account)
  • Should say now logged in as username..in terminal.

Clone A GitHub Repository to Your Local Computer

  • Open Terminal
  • cd into project folder
  • Use the ‘$ gh repo clone’ command from the repo to download.
    • example: $ gh repo clone nrodx/exampleapp
    • This will clone the repo into the current working directory in terminal.
    • Should say done.
    • Should have project now in working directory, now use VS Code!

Open the project folder on your local computer with VS Code.

Within VS Code, now you can open the project folder, it should recognize that its git initialized and then pop up in your source control in the side panel!

Good Luck and Cheers!

Share the Post:

Related Posts