Introduction to Git Bash and GitHub for Beginners

Published: (January 18, 2026 at 05:13 AM EST)
4 min read
Source: Dev.to

Source: Dev.to

What is Git?

Git is a free, open‑source version control system that tracks changes in your code (or any files) over time. It lets developers:

  • Work on projects of any size
  • Revert to previous versions if needed
  • Experiment safely with branches
  • Collaborate without overwriting each other’s work

What is Git Bash?

Bash is the default command‑line shell on Linux and macOS.

Git Bash is a lightweight Windows application that provides a Bash‑like, Unix‑style terminal environment, including all Git commands. It lets Windows users run Git and many Unix commands seamlessly in a familiar shell.

Git Bash is installed locally on your computer.

Git Bash screenshot

What is GitHub?

GitHub is a cloud‑based hosting platform built on top of Git. It lets you:

  • Store Git repositories online
  • Share code with others
  • Collaborate in teams
  • Review changes via pull requests
  • Discover open‑source projects

GitHub screenshot

Installing Git Bash (Windows)

  1. Go to the official Git website.
  2. Download the Windows installer (it includes Git Bash).
  3. Run the downloaded .exe file and follow the setup wizard.
    • Accept the defaults for most options (they work well for beginners).
    • Choose your preferred text editor (e.g., Notepad++, VS Code).
    • Keep line‑ending conversion enabled for cross‑platform compatibility.
  4. Complete the installation.

Verify Installation

Open Git Bash (search for “Git Bash” in the Start menu) and run:

git --version

You should see something like git version 2.xx.x.windows.x.

Initial Git Configuration

Set your name and email (these appear in your commits):

git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"

Use the same email you have on your GitHub account.

Linking Git Bash to Your GitHub Account (Using SSH)

SSH keys provide secure, password‑less authentication for pushing/pulling code.

  1. Generate a new SSH key (in Git Bash)

    ssh-keygen -t ed25519 -C "your.email@example.com"
    • Press Enter to accept the default file location (~/.ssh/id_ed25519).
    • Optionally set a passphrase (recommended for extra security).
  2. Start the SSH agent and add your key:

    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_ed25519
  3. Copy your public key to the clipboard:

    cat ~/.ssh/id_ed25519.pub

    (Select and copy the output that starts with ssh-ed25519 ….)

  4. Add the key to GitHub

    • Log in to GitHub → click your profile picture → SettingsSSH and GPG keysNew SSH key.
    • Give it a title (e.g., “My Windows PC”).
    • Paste the key and click Add SSH key.
  5. Test the connection

    ssh -T git@github.com

    You should see: Hi <username>! You've successfully authenticated…

Pulling and Pushing Code

git pull

Fetches changes from the remote repository (e.g., GitHub) and merges them into your current branch.

git pull origin main

(git pull = git fetch + git merge)

Tip: Always pull before you start work to avoid conflicts.

git push

Uploads your local commits to the remote repository.

git push origin main
  • origin – default name for your GitHub remote.
  • main – default branch name (some older repos use master).

If it’s your first push to a new repo, set the upstream branch:

git push -u origin main

Push workflow screenshot

Tracking Changes – The Core Workflow

git status

Shows what’s changed, staged, or untracked.

git status

git add

Stages changes (prepares them for commit).

  • Stage a single file: git add filename.txt
  • Stage everything: git add . or git add -A

git commit

Saves staged changes permanently with a message.

git commit -m "Add new feature: user login page"

Good commit messages are short, descriptive, and written in the present tense (e.g., “Fix bug in login form”).

Typical workflow

git status          # Check what’s changed
# …edit files…
git add .           # Stage everything
git commit -m "Your message here"
git pull origin main   # Get latest changes first!
git push origin main   # Send your work to GitHub

What Is Version Control and Why It Matters

Version control records every change to files over time so you can recall specific versions later.

Key benefits

  • Full history of who changed what and why.
  • Branching & merging – work on features or bug fixes in isolation, then combine safely.
  • Easy rollback if something breaks.
  • Collaboration – multiple people can work on the same project without chaos.
  • Backup – your code lives safely on GitHub.

Master these basics, and you’ll be ready to create repositories, clone projects, create branches, and contribute to open source!

Happy coding!

Feel free to practice by creating a simple repo on GitHub and pushing a “Hello World” file.

Back to Blog

Related posts

Read more »

Introduction to Gitbash and Github

Definitions - Git is a widely used, free, and open‑source system designed to handle projects of all sizes. It enables developers to track changes in code and f...

Introduction to Git and Github

Why version control is important - Every change is recorded - You can go back to older versions of your code - You can see who made a change and when - Multipl...