Falytom logoFALYTOM
Games
ToolsUI ComponentsServicesProductsAbout
menu
  1. Home
  2. /Web Development
  3. /Github
  4. /Installing Configuring Git
Your Progress0%
0 of 20 completed

Git & Github Topics

Getting Started

  • What is Git?
  • What is GitHub?
  • Installing & Configuring Git
  • Your First Git Repository

Core Git Concepts

  • Understanding Commits & History
  • Working with Branches
  • Merging Branches
  • The Staging Area
  • Undoing Changes

Working with GitHub

  • Connecting to GitHub
  • Pushing & Pulling Code
  • Cloning Repositories
  • GitHub README & Documentation

Collaboration Workflows

  • Forking & Pull Requests
  • Code Review Basics
  • Handling Merge Conflicts
  • Issues & Project Management

Best Practices & Workflows

  • Git Workflow Best Practices
  • Working with .gitignore
  • Common Git Problems & Solutions

Installing & Configuring Git

Get Git set up on your computer and ready for development

Before you can start using Git to track your projects, you need to install it on your computer and configure it with your identity. This lesson will walk you through installing Git on Windows, macOS, and Linux, then show you how to configure the essential settings that identify you as the author of your commits. By the end, you'll have Git fully set up and ready to create your first repository!

Step 1: Check If Git Is Already Installed

Before installing Git, let's check if it's already on your system. Many computers, especially Macs and Linux machines, come with Git pre-installed.

Open Your Terminal/Command Prompt

First, you need to open a command-line interface:

  • Windows: Search for "Command Prompt" or "PowerShell" in the Start menu
  • Mac: Open "Terminal" from Applications → Utilities, or press Cmd + Space and type "Terminal"
  • Linux: Press Ctrl + Alt + T or search for "Terminal" in your applications

Check the Git Version

In your terminal, type this command and press Enter:

BASH
git --version

You'll see one of two results:

Git is installed: You'll see something like:

BASH
git version 2.43.0

Great! You can skip to the configuration section. The exact version number doesn't matter much—any version 2.x is fine for learning.

Git is not installed: You'll see an error like:

BASH
'git' is not recognized as an internal or external command

No problem! Continue to the installation section below for your operating system.

Installing Git on Windows

Windows doesn't include Git by default, but installation is straightforward.

Method 1: Official Git for Windows (Recommended)

  1. Download the installer: Go to git-scm.com/download/win and the download should start automatically
  2. Run the installer: Double-click the downloaded .exe file
  3. Follow the installation wizard: You'll see many options—here are the recommended settings:

Important Installation Options:

  • Select Components: Keep default selections (Git Bash, Git GUI)
  • Default editor: Choose your preferred text editor (VS Code is recommended if you have it)
  • PATH environment: Select "Git from the command line and also from 3rd-party software"
  • Line ending conversions: Choose "Checkout Windows-style, commit Unix-style"
  • Terminal emulator: Use MinTTY (default)
  • Default branch name: Override to use "main"

For most other options, the defaults are fine. Just keep clicking "Next"!

  1. Complete the installation: Click "Install" and wait for it to finish
  2. Verify installation: Open a new Command Prompt or PowerShell window and run:
BASH
git --version

You should see the Git version number!

Method 2: Using Package Managers

If you use Windows package managers, you can also install Git through:

  • Chocolatey: choco install git
  • Winget: winget install Git.Git

🎨 Git Bash

Git for Windows includes "Git Bash", a Unix-style terminal that many developers prefer. You can find it in your Start menu after installation. It provides a consistent command-line experience similar to Mac and Linux.

Installing Git on macOS

macOS usually includes an older version of Git, but we recommend installing a newer version.

Method 1: Using Homebrew (Recommended)

Homebrew is a popular package manager for Mac that makes installing developer tools easy.

  1. Install Homebrew (if you don't have it):
BASH
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install Git using Homebrew:
BASH
brew install git
  1. Verify installation:
BASH
git --version

Method 2: Official Git Installer

  1. Download the installer from git-scm.com/download/mac
  2. Open the .dmg file and follow the instructions
  3. Verify installation in Terminal with git --version

Method 3: Xcode Command Line Tools

Installing Xcode Command Line Tools will also install Git:

BASH
xcode-select --install

A popup will appear—click "Install" and agree to the license terms.

🍎 Mac Users

If you plan to do any development on Mac, Homebrew is incredibly useful for installing other tools too. We highly recommend the Homebrew method!

Installing Git on Linux

Most Linux distributions make it easy to install Git using their package manager.

Debian/Ubuntu

BASH
# Update package list
sudo apt update

# Install Git
sudo apt install git

# Verify installation
git --version

Fedora

BASH
# Install Git
sudo dnf install git

# Verify installation
git --version

Arch Linux

BASH
# Install Git
sudo pacman -S git

# Verify installation
git --version

CentOS/RHEL

BASH
# Install Git
sudo yum install git

# Verify installation
git --version

🐧 Linux Users

If you're on a different Linux distribution, check your distribution's documentation for the package manager command. Git is available in virtually all Linux repositories!

Step 2: Configure Your Identity

Now that Git is installed, you need to configure it with your name and email. This information is attached to every commit you make, so others know who made which changes.

Important: Git requires this configuration before you can make your first commit. If you skip this step, Git will complain when you try to commit changes!

Set Your Name

This should be your real name or the name you want associated with your work:

BASH
git config --global user.name "Your Name"

Replace "Your Name" with your actual name, for example:

BASH
git config --global user.name "Sarah Johnson"

Set Your Email

Use the email address associated with your GitHub account (if you created one):

BASH
git config --global user.email "your.email@example.com"

For example:

BASH
git config --global user.email "sarah.johnson@example.com"

GitHub Email Privacy: If you want to keep your email private, GitHub provides a no-reply email address you can use. Find it in your GitHub settings under Emails. It looks like: 123456+username@users.noreply.github.com

Understanding --global

The --global flag means these settings apply to all Git repositories on your computer. You only need to do this once!

If you ever need different settings for a specific project, you can omit --global and run the commands inside that project's directory.

Step 3: Verify Your Configuration

Let's make sure everything is set up correctly.

Check Specific Settings

View your configured name:

BASH
git config --global user.name

View your configured email:

BASH
git config --global user.email

View All Configuration

See all your Git settings at once:

BASH
git config --list

This will show something like:

BASH
user.name=Sarah Johnson
user.email=sarah.johnson@example.com
core.editor=code --wait
init.defaultbranch=main
...

✅ Configuration Complete!

If you see your name and email when running these commands, you're all set! Git is now configured and ready to use.

Step 4: Additional Useful Configuration

While name and email are required, here are some other settings that will improve your Git experience:

Set Default Branch Name to "main"

Modern Git uses "main" as the default branch name instead of "master":

BASH
git config --global init.defaultBranch main

Set Your Preferred Text Editor

Git will open a text editor for commit messages. Set your preferred editor:

BASH
# For Visual Studio Code
git config --global core.editor "code --wait"

# For Nano (simple terminal editor)
git config --global core.editor "nano"

# For Vim
git config --global core.editor "vim"

# For Sublime Text
git config --global core.editor "subl -n -w"

💡 Editor Recommendation

If you're new to the command line, we recommend VS Code or Nano. Vim and Emacs are powerful but have a steeper learning curve.

Enable Helpful Colors

Make Git output more readable with colors (usually enabled by default):

BASH
git config --global color.ui auto

Set Up Line Ending Handling

This helps prevent issues when working with people on different operating systems:

BASH
# For Windows
git config --global core.autocrlf true

# For Mac/Linux
git config --global core.autocrlf input

Why this matters: Windows uses different line endings (CRLF) than Mac/Linux (LF). This setting automatically handles the conversion so everyone sees consistent files.

Step 5: Set Up Credential Helper (Optional but Recommended)

Without a credential helper, Git will ask for your GitHub username and password every time you push or pull. Let's fix that!

For Windows

If you installed Git for Windows, the credential manager is already set up. Verify with:

BASH
git config --global credential.helper

You should see manager-core or manager.

For macOS

Use the built-in Keychain credential helper:

BASH
git config --global credential.helper osxkeychain

For Linux

Set up the cache credential helper:

BASH
# Store credentials for 1 hour
git config --global credential.helper cache

# Or store credentials for longer (e.g., 10 hours)
git config --global credential.helper 'cache --timeout=36000'

🔐 About Credentials

Note: GitHub no longer accepts password authentication. In a later lesson, we'll set up SSH keys or Personal Access Tokens for secure authentication with GitHub. The credential helper will store whichever method you choose!

Understanding Configuration Levels

Git has three levels of configuration:

1. System Level (All Users)

BASH
git config --system

Applies to all users on the computer. Rarely used and requires admin privileges.

2. Global Level (Your User)

BASH
git config --global

Applies to all your repositories. This is what we've been using and is the most common level.

3. Local Level (One Repository)

BASH
git config --local

Applies only to the current repository. Used when you need different settings for a specific project.

Local settings override global settings, and global settings override system settings.

Editing Configuration File Directly (Advanced)

If you prefer, you can edit the configuration file directly instead of using commands:

BASH
# Open global config in your default editor
git config --global --edit

This opens your global config file (usually located at ~/.gitconfig on Mac/Linux or C:\Users\YourName\.gitconfig on Windows).

The file looks like this:

.gitconfig
[user]
    name = Sarah Johnson
    email = sarah.johnson@example.com
[core]
    editor = code --wait
[init]
    defaultBranch = main
[color]
    ui = auto

You can edit this file manually, but using git config commands is safer for beginners.

Troubleshooting Common Issues

Issue: Command Not Found

Problem: After installation, you get "command not found" or "git is not recognized"

Solution:

  • Close and reopen your terminal/command prompt
  • On Windows, restart your computer (this updates the PATH)
  • Verify Git is in your PATH: on Windows, search for "Environment Variables" and check if Git's bin directory is listed

Issue: Permission Denied

Problem: You get permission denied errors

Solution:

  • On Linux/Mac, don't use sudo with git config commands
  • Check file permissions on your config file
  • Make sure you're not trying to configure system-level settings

Issue: Editor Won't Close

Problem: Git opens Vim and you can't figure out how to exit

Solution:

  • Press Esc to enter command mode
  • Type :q! and press Enter to quit without saving
  • Set a different editor as shown above to avoid Vim in the future

Issue: Wrong Name or Email

Problem: You configured the wrong name or email

Solution: Just run the config command again with the correct information—it will overwrite the old value:

BASH
git config --global user.name "Correct Name"
git config --global user.email "correct.email@example.com"

Testing Your Installation

Let's verify everything is working correctly with a few commands:

Test Your Git Installation

Try these commands to verify your setup

$

Try these examples:

All commands should work without errors!

Useful Configuration Commands

Here's a quick reference of common config commands:

BASH
# View all configuration
git config --list

# View configuration with file origins
git config --list --show-origin

# Get a specific setting
git config user.name

# Set a value
git config --global user.name "Your Name"

# Unset (remove) a value
git config --global --unset user.name

# Edit configuration file directly
git config --global --edit

# Get help on configuration
git config --help

What You Can Do Now

With Git installed and configured, you're ready to start using it! Here's a preview of what's coming:

  • Create repositories: Initialize Git in your projects
  • Make commits: Save snapshots of your work
  • View history: See all the changes you've made over time
  • Create branches: Try different ideas safely
  • Connect to GitHub: Share your work and collaborate

In the next lesson, we'll create your first Git repository and make your first commit!

Key Takeaways

  • Check if Git is installed with git --version
  • Installation methods vary by OS: official installer, Homebrew, or package managers
  • You must configure your name and email before making commits
  • Use --global flag to apply settings to all repositories
  • Set your default branch name to "main" for consistency
  • Configure a text editor for writing commit messages
  • Use credential helpers to avoid typing passwords repeatedly
  • Configuration can be system-level, global (user), or local (repository)
  • Use git config --list to view all your settings
  • If you make mistakes, just run the config command again to fix it

What's Next?

Congratulations! You've successfully installed and configured Git. You now have everything you need to start tracking your projects.

In the next lesson, we'll create your very first Git repository, make some changes, and create your first commits. You'll see Git in action and start building your understanding of the commit workflow!

🎯 Before the Next Lesson

Make sure you can successfully run these commands:

  • git --version (shows version number)
  • git config user.name (shows your name)
  • git config user.email (shows your email)

If all three work, you're ready to move forward!

Test Your Understanding of Git Installation

Question 1 of 4

What command do you use to check if Git is installed?

Current Score0 / 0

Know someone who'd find this guide helpful? Please share!

Previous
What is GitHub?
Next
Your First Git Repository

Never Miss a New Git & GitHub Tutorial

Join 2,000+ developers learning Git & GitHub step-by-step. Get new tutorials, tips, and exclusive resources delivered to your inbox - completely FREE.

You might also like

UI Components

Ready-made components for your projects

Developer Tools

Boost productivity with handy generators

HTML Game

Learn HTML concepts through interactive gameplay

Join Our Web Development Training Program

Master frontend & backend development with hands-on projects.

Git & Github Tutorials

0 of 20 completed

Your Progress0%

Topics

Getting Started

  • What is Git?
  • What is GitHub?
  • Installing & Configuring Git
  • Your First Git Repository

Core Git Concepts

  • Understanding Commits & History
  • Working with Branches
  • Merging Branches
  • The Staging Area
  • Undoing Changes

Working with GitHub

  • Connecting to GitHub
  • Pushing & Pulling Code
  • Cloning Repositories
  • GitHub README & Documentation

Collaboration Workflows

  • Forking & Pull Requests
  • Code Review Basics
  • Handling Merge Conflicts
  • Issues & Project Management

Best Practices & Workflows

  • Git Workflow Best Practices
  • Working with .gitignore
  • Common Git Problems & Solutions
Falytom logoFALYTOM

Learn technologies like HTML, CSS, JavaScript, React, NodeJS and more through interactive games, tutorials, components and free tools. Transform your businesses with AI chatbots, SEO-optimized websites, and professional development services.

© 2025 Tomilola Group
  • Facebook logo
  • Twitter logo
  • Instagram logo
  • LinkedIn logo
  • GitHub logo
  • YouTube logo