DEV Community

Cover image for How to Set Up Git on Windows or macOS (Easy Guide)
ncutixavier
ncutixavier

Posted on

How to Set Up Git on Windows or macOS (Easy Guide)

Git helps you save versions of your projects and collaborate with others.
This quick guide shows you how to install and configure Git on Windows or macOS in the simplest way.


1. Install Git on Windows

Step 1: Download Git

  1. Visit: https://git-scm.com
  2. Click Download for Windows.

Step 2: Install

Open the downloaded file and follow the steps.
You can keep the default settings — they work for most people.

Step 3: Verify

Open Command Prompt or PowerShell and run:

git --version
Enter fullscreen mode Exit fullscreen mode

If you see a version number, Git is ready.


2. Install Git on macOS

Option A: Use Terminal (Most Common)

Open Terminal and type:

git --version
Enter fullscreen mode Exit fullscreen mode

If Git isn’t installed, macOS will ask you to install Command Line Tools.
Click Install.

Option B: Using Homebrew

If you prefer Homebrew, run:

brew install git
Enter fullscreen mode Exit fullscreen mode

3. Configure Git (Windows & macOS)

Set your name and email so your commits are labeled correctly:

git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"
Enter fullscreen mode Exit fullscreen mode

Check your settings with:

git config --list
Enter fullscreen mode Exit fullscreen mode

4. Test Git

Try cloning a test project:

git clone https://github.com/username/repository.git
Enter fullscreen mode Exit fullscreen mode

If it downloads, everything is working.


5. Basic Git Commands to Start Using

Action Command
Create a new Git project git init
Check changes git status
Add files git add .
Save changes git commit -m "message"
Connect to online repo git remote add origin <url>
Upload your code git push -u origin main
Download updates git pull

🎉 Done!

Top comments (0)