← Back to Home
πŸ™

Introduction to Git & GitHub

The version-control foundation every DevOps engineer builds on.

⏱9 min readπŸ“šDevOps Fundamentals

If Linux is where your code runs, Git is how your code is tracked, shared, and shipped. Every serious software and DevOps team on the planet uses version control β€” and Git is the standard.


🎯 Learning Objectives

By the end of this lesson you will:


What is Version Control?

Version control is a system that records changes to your files over time, so you can:

Without it, teams end up with folders like project_final_v2_REALLY_final.zip. Git ends that chaos.


Git vs GitHub β€” What’s the Difference?

Git GitHub
What it is A tool that runs on your machine A website / cloud service
Job Tracks changes locally Hosts your Git repositories online
Works offline? Yes No (it’s a remote)
Analogy The camera taking snapshots The photo album you share with others

πŸ’‘ The one-line version

Git is the version-control tool. GitHub is a place to store and share Git repositories in the cloud (alternatives include GitLab and Bitbucket).


The Core Git Workflow

Almost everything in Git follows this cycle:

text
Working Directory   β†’   Staging Area   β†’   Repository   β†’   GitHub
 (edit files)         (git add)        (git commit)     (git push)

You edit files, stage the changes you want to keep, commit them as a snapshot, and push them to GitHub to share.


Install & Configure Git

bash
sudo apt update && sudo apt install git -y   # Ubuntu / WSL
git --version                                # verify

Set your identity once β€” every commit you make is stamped with it:

bash
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
bash β€” 80Γ—24
student@devops:~$git --version && git config --global user.name

πŸ§ͺ Hands-on Lab

πŸ“

Set Up Git on Your Machine

  1. Install Git and confirm the version
  2. Set your global user.name and user.email
  3. Confirm the settings with git config --list

🧠 Knowledge Check

Knowledge Check

What is the main difference between Git and GitHub?

Knowledge Check

Which command records a snapshot of your staged changes?


πŸ’Ό Interview Preparation

Interview Q&A

Why do DevOps teams consider Git essential?


Summary

You now understand what version control is, how Git and GitHub differ, and the edit β†’ add β†’ commit β†’ push workflow. Next, you’ll run these commands for real.

Up Next

Git Basics β€” Your First Repository

You've mastered this lesson. Continue your journey to becoming a DevOps Engineer.

Start Next Lesson→