top of page

GitHub Setup & Local Integration

  • Michael He
  • Sep 27, 2025
  • 2 min read

Updated: Oct 4, 2025


Summary -

  1. Create a GitHub Account

  2. Install Git Locally

  3. Configure Git Locally - (Git's Local Architecture!)

  4. Initialize "Local Repo"

  5. Add files into "Staging Area"

  6. Commit files into "Local Repo"

  7. Push "Local Repo" to "Remote Repo" - Github

  8. Add a "README" file

  9. Add a ".gitignore" file: something you do't want to get to be pushed to the GitHub

  10. Git Clone via SSH & testing with # git clone




  1. Create a GitHub Account

    • Go to github.com

    • Click Sign up and follow the prompts to create your account.

    • Choose a username, enter your email, and set a secure password.

    • Verify your email and complete the onboarding steps.


  1. Install Git Locally

    • Download Git from git-scm.com

    • Run the installer and accept default settings (especially “Git from the command line” option).

    • To verify:


  2. Configure Git Locally

    • Git's Local Architecture:

      WORKING DIR -> STAGING AREA -> LOCAL REPO


    • Run the following commands:

      • # git config --global user.name "user name"

      • # git config --global user.email "your_email@example.com"

      • to check user.name and user.email

        • # git config --global user.name

        • # git config --global user.email

      • git config --global init.defaultBranch main # change default branch to main

        • to check branch # git config --global init.defaultBranch


  1. Initialize local repository

    • Open your project with VS code

      (I am using a mock project for demo purpose)


  • Initialize local repository

    • # git init


    • It will create a .git file. If you want to delete it, just # rm -rf .git

      - You noticed the files became in green and having a "U" next to them, which meaning they are un-tracked now

      - They are still in "working area"


    • To check status: # git status

  1. Add files into "staging area"

    1. # git add <file_name>

      • notice: file index.html became "A" - added to "staging area"

    2. To add ALL files into "staging area" # git add .



  1. Commit files into "Local Repo"

    • # git commit -m 'Initial commit to local repo'

    • Now, if you are making any changes to your project and/or files, you will need to add them to both staging and local repo AGAIN!

      • "staging area": # git add .

      • then to "local area": # git commit -m 'message_here'

    • To check history / logs: # git log


  1. Push "Local Repo" to "Remote Repo" at Github

    1. Create a repo at github side, normally make the repo same name as your project

b. Copy and run these commands on your local PC once you click "Create repository" button above





Now I am showing my files on Github repo now -



  1. Add a "README" file





Now, we can pull this README file from your local PC: # git pull



  1. Add a ".gitignore" file


    Say you have .env file, and you do not want get it to the Github

You add the .env filename into .gitignore file

# git add . -> git commit -m 'Added gitignore file' -> git push


Now you will see .gitignore file on Github, but .env file isn't here -



  1. Git Clone via SSH




Now you need to put public key to Github -


Copy your public key:





** make sure you run the following commands


To test:























 
 
 

Comments


bottom of page