Skip to the content.

What is Git & GitHub? – Prep Guide

🇯🇵 日本語版: 00_Prep.md

This is a guide to get you ready for the Intro to Git & GitHub lecture.

Here are the steps to do in preparation for the lecture (in order):

  1. GitHub.com Account
  2. Visual Studio Code (VS Code) + Command Line
  3. Install Git
  4. GitHub Desktop App
  5. GitHub Command Line (GitHub CLI)
  6. Configure Git

Outline


GitHub.com Account

Step 1 - Create a GitHub.com Account

Create a GitHub.com account by signing up here:

Check out unsplash.com for free images to use for your profile pic:

Step 2 - Set up Two-Factor Authentication

  1. Open GitHub.com’s Two-factor authentication settings: github.com/settings/security
    • Click on the Enable two-factor authentication button
    • Select Set up using an app option and click the Continue button
  2. Scan the QR Code with a two-factor authentication app
  3. Enter the 6-digit code from the two-factor authentication app
  4. Download the recovery codes and click the I have saved my recovery codes button
  5. Finally, click the Done button

Here is a gif that goes over Step 2:

Resources


Visual Studio Code (VS Code) + Command Line

Install VS Code from here:

Setup the ability to open VS Code from the command line:

  1. Launch VS Code App
  2. Open the Command Palette with the following shortcut:
    • Mac: Command + Shift + P
    • Windows: Ctrl + Shift + P
  3. Type shell and select the Shell Command: Install 'code' command in PATH option
    • VSCode_shell_command.png
  4. Restart the Terminal
  5. In the Terminal, type code . to open the current folder in VS Code

Install Git

Install Git for MacOS

  1. Install Homebrew (brew.sh) with the following command:

     /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. Update and upgrade brew before installing new packages

     brew update && brew upgrade
    
  3. Install git with Homebrew

     brew install git
    
  4. Confirm the install by checking the git version

     git --version
    
     # If you see this, you are all set!
     git version 2.36.1
    

Debugging

   
If the following result is returned git version 1.7.10.2 (Apple Git-33)
Run this command! brew link --force git
Or do this! export PATH=/usr/local/bin:$PATH

Now you are ready!

Next section is GitHub Desktop App!


Install Git for Windows 10

  1. Install git for windows from gitforwindows.org
  2. Accept the Installation Wizard’s default setting EXCEPT for the following settings:
    1. For Choosing the default editor used by Git setting, select the Use Visual Studio Code as Git's default editor option
    2. For Adjusting the name of the initial branch in new repositories setting, select the Override the default branch name for new repositories option
    3. For Configuring the line ending conversions setting, select the Checkout as is, commit as is option
    4. For Configuring the terminal emulator to use with Git Bash setting, select the Use Windows's default console window option
    5. For the last settings page, select the Launch Git Bash option and deselect the View Release Notes option

Screenshots of the Installation Wizard settings

The non-default settings are highlighted.

   
windows_git_step_1.png windows_git_step_2.png
windows_git_step_3.png windows_git_step_4.png
windows_git_step_5.png windows_git_step_6.png
windows_git_step_7.png windows_git_step_8.png
windows_git_step_9.png windows_git_step_10.png
windows_git_step_11.png windows_git_step_12.png
windows_git_step_13.png windows_git_step_14.png

Now you are ready!

Next section is GitHub Desktop App!


GitHub Desktop App

  1. Download the GitHub Desktop App from here: desktop.github.com
  2. Then click the Sign in to GitHub.com button
  3. A browser window will launch
  4. Log into your GitHub.com account by following the screenshots below:
       
Step 1 GitHubDesktop_1.png Step 2 GitHubDesktop_2.png
Step 3 GitHubDesktop_3.png Step 4 GitHubDesktop_4.png
Step 5 GitHubDesktop_5.png Step 6 GitHubDesktop_6.png

GitHub Desktop App’s documentation:


GitHub Command Line (GitHub CLI)

GitHub CLI for MacOS

  1. Update and upgrade brew before installing new packages

     brew update && brew upgrade
    
  2. Install GitHub CLI with the following command:

     brew install gh
    
  3. Restart the computer before using GitHub CLI

Now you are ready!

Next section is Configure Git!

GitHub CLI for Windows

  1. Install GitHub CLI by going to cli.github.com and clicking on the Download for Windows button
  2. Accept the Installation Wizard’s default setting
  3. Restart the computer before using GitHub CLI

Now you are ready!

Next section is Configure Git!


Configure Git

Add GitHub.com Login

We will use GitHub CLI’s gh auth login command to configure the GitHub login

Where to run the commands?

Add GitHub.com login to your computer by going through the following steps:

  1. Run gh auth login command
  2. For What account do you want to log into? prompt, select GitHub.com option
  3. For What is your preferred protocol for Git operations? prompt, select HTTPS option
  4. For Authenticate Git with your GitHub credentials? (Y/n) prompt, type y
  5. Copy the 9-character code and hit enter
  6. A browser window will launch
  7. Enter the 9-character code to the GitHub website
  8. Click the Authorize button

Confirm GitHub Authentications were Successful

Confirm settings with the following command: gh auth status

This is what you want to see:

  ❯ gh auth status
  github.com
    ✓ Logged in to github.com as ahandsel (/Users/***/.config/gh/hosts.yml)
    ✓ Git operations for github.com configured to use https protocol.
    ✓ Token: *******************

  github.dev.ahandsel.co.jp
    ✓ Logged in to github.dev.ahandsel.co.jp as ahandsel (/Users/***/.config/gh/hosts.yml)
    ✓ Git operations for github.dev.ahandsel.co.jp configured to use https protocol.
    ✓ Token: *******************

Default Branch - main

Use the following command to set the default branch name to main for your computer.

git config --global init.defaultBranch main

Optional Setups

Windows - Install cash

  1. Install Node.js on Windows
    • [Download Node.js](https://nodejs.org/en/download/)
  2. Verify Node.js installation by running the following command on Command Prompt
    • node --version
  3. Install dthree/cash so you can run Linux commands on Windows Command Prompt
    • Install command: npm install cash-global -g

Next section - Basics and Settings

Go to the Basics & First Repo - 01_Start_EN.md section 💪

List of Lecture Guides

README_EN.md ⚙️