How to Install Git on Windows, Mac, and Linux

When you’re ready to dive into software development, knowing how to install Git is a critical skill. Git is an important tool for version control, enabling developers to manage changes to source code efficiently.
Whether you’re using Windows, macOS, or a variety of Linux distributions like Ubuntu or Fedora, installing Git sets the foundation for smooth workflow and collaboration with platforms like GitHub or Bitbucket.
In this guide, you’ll learn the entire process of setting up Git on your system, from downloading the installer package to configuring your Git settings. Master commands through the Command Prompt or Terminal, configure SSH keys, and understand how Git version control can improve your software projects.
By the end of this article, you’ll be equipped with the knowledge to initiate your own repositories and manage code like a pro, ensuring your projects benefit from the flexibility and security that Git provides.
How To Install Git: Quick Workflow
Installing Git varies depending on your operating system. Below are step-by-step guides for Windows, macOS, and Linux.
Installing Git on Windows
Download Git for Windows: Go to the official Git for Windows website and download the latest version.
Run the Installer: Double-click the downloaded file to start the installation process.
Follow the Installation Wizard:
Review the GNU General Public License and click Next.
Choose an installation location and click Next.
Select components to install and click Next.
Create a start menu folder and click Next.
Choose a text editor (e.g., Notepad++) and click Next.
Complete Installation: Follow any remaining prompts to finish the installation.
Verify Installation: Open Command Prompt or Git Bash and type
git --version
to verify that Git is installed correctly.
Alternatively, you can use Winget (Windows Package Manager) to install Git via PowerShell:
winget install --id Git.Git -e --source winget
Installing Git on macOS
Install Homebrew: If you haven’t installed Homebrew yet, follow the instructions on the Homebrew website.
Install Git Using Homebrew: Open Terminal and run:
brew install git
Verify Installation: Type
git --version
in Terminal to confirm that Git is installed.
Installing Git on Linux
Update Package List: Open Terminal and update your package list:
sudo apt-get update # For Debian/Ubuntu
sudo dnf update # For Fedora/RHEL/CentOS
Install Git:
sudo apt-get install git # For Debian/Ubuntu
sudo dnf install git # For Fedora/RHEL/CentOS
Verify Installation: Run
git --version
to ensure Git is installed correctly.
After installing Git, you may want to configure your username and email for Git by running:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Installing Git on Windows

Method 1: Installing Git Using the Official Git for Windows Installer
Downloading the installer from the official website
Head to the official Git website. Grab the installer for Windows. Keep it simple. Ensure you download the latest version, and make that download your first step.
Running the setup wizard and selecting installation options
Launch the installer. The setup wizard guides you through each stage. Stick to recommended settings unless customization is necessary. Choose Git Bash for a command-line experience similar to Linux or macOS.
Configuring Git defaults (text editor, PATH, HTTPS transport)
When prompted, select your preferred text editor—VS Code or Notepad++ are popular choices. Configure your system’s PATH for command-line access. Choose HTTPS for secure connections.
Completing installation and verifying Git version
Finish the setup. To confirm, open Command Prompt and type git --version
. If the version displays, success is yours.
Method 2: Installing Git Using Chocolatey Package Manager
Installing Chocolatey (if not already installed)
If Chocolatey isn’t yet part of your tools, open PowerShell as Admin. Execute the command provided on Chocolatey’s website. This package manager simplifies installs.
Running the command to install Git via Chocolatey
In PowerShell, use choco install git
. Chocolatey handles dependencies, so take advantage of this for efficient installs.
Verifying installation through the command line
Just as before, check the setup. Run git --version
in Command Prompt to ensure Chocolatey’s magic worked.
Method 3: Installing Git Using Windows Subsystem for Linux (WSL)
Setting up WSL on Windows
WSL brings the Linux experience. Begin WSL setup via PowerShell: wsl --install
. Follow prompts to add a Linux distro. Ubuntu is a friendly choice.
Installing Git within a Linux distribution (Ubuntu, Debian, etc.)
Use sudo apt-get update
, then sudo apt-get install git
. Commands are familiar if you’ve danced with Linux before. Installation is quick and direct.
Verifying installation and configuring Git
Type git --version
in Linux Terminal. If you see the version, it’s all good. Configure using git config --global
commands for identity settings.
Method 4: Installing Git via GitHub Desktop
Downloading and installing GitHub Desktop
Visit GitHub Desktop’s site for a fresh download. Their setup process is quick, blending Git control with a GUI.
Using GitHub Desktop to manage repositories graphically
Sign in with your account. Create or clone repositories. GitHub Desktop simplifies managing remote repositories with a visual touch.
Verifying Git installation via the GUI or command line
Within GitHub Desktop, there’s a Repository option to see your setup. Or, use Command Prompt—run git --version
just to double-check. Git’s ready to roll.
Installing Git on macOS

Method 1: Installing Git Using the macOS Installer
Downloading the Git for Mac installer
Head directly to the Git website. Get the macOS installer. Version is on you—ensure it’s the latest. Download, and you’re set to start.
Running the installation wizard
Open the installer. The wizard guides through this. Default settings usually work best. The interface is smooth, making it simple.
Verifying Git installation through Terminal
Finish up and launch Terminal. Type git --version
. If a version number shows, the installation was a success. No need for further actions there.
Method 2: Installing Git Using Homebrew
Installing Homebrew (if not already installed)
Install Homebrew if it’s absent: Open Terminal and paste /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
. Prompt-driven; follow instructions.
Running the command to install Git
With Homebrew ready, run brew install git
. Simple, right? Dependencies managed. Installs in a snap.
Configuring Git and verifying installation
Type git --version
in Terminal. Confirm it’s there. Then configure username and email using git config --global
. Sets up your identity for commits.
Method 3: Installing Git Using MacPorts
Setting up MacPorts on macOS
MacPorts gives another route. Check it’s installed: Download from the MacPorts site. Install as directed. Simple paths lead to good setups.
Searching for and installing the latest Git version
Fire up Terminal: sudo port selfupdate
and sudo port install git
. The system handles it from here. Efficient and clean.
Configuring Git with MacPorts
Run git --version
. It’s a quick check, ensuring everything clicks. Use git config --global
commands for final touches on your setup.
Configuring Git for macOS
Setting global user credentials
Identify yourself with git config --global user.name "Your Name"
and git config --global user.email "email@example.com"
. Links changes to you.
Enabling the Git credential helper for secure authentication
Activate helper using git config --global credential.helper osxkeychain
. Keeps passwords secure, making login smoother.
Optimizing Git settings for macOS users
Consider adding aliases for common Git commands in your setup. Adjust settings like auto-correct with git config --global help.autocorrect 1
for efficiency.
Installing Git on Linux

Installing Git via Package Managers
Debian/Ubuntu-based distributions
Updating system packages
Begin by updating. In Terminal, enter sudo apt-get update
. This ensures you have the latest package information. System readiness: check.
Installing Git using apt-get
For installation, go with sudo apt-get install git
. Apt handles the details, giving you a smooth experience. A virtual handshake with Git.
Verifying installation and setting user credentials
Confirm the setup: git --version
. Next, set user credentials. Use git config --global user.name "Your Name"
and git config --global user.email "email@example.com"
to ensure your identity is clear in commits.
Fedora-based distributions
Installing Git using dnf or yum
For Fedora, type sudo dnf install git
. Using RHEL? Go with sudo yum install git
. Both paths guide you to the same destination, Git-ready systems.
Configuring Git for Fedora/RHEL systems
Post-installation, check with git --version
. Identity tweaks follow: use the same configuration commands to finalize the setup. Commit from comfort.
Installing Git from Source
Reasons for installing from source (latest features, customization)
The source provides freedom. Access the latest features and customize to match your needs. Precision equals power.
Installing dependencies required for compilation
Dependencies come first. Typical command: sudo apt-get install libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext
. Tools make the job smoother.
Downloading the latest Git source code
Go to Git’s official mirror to grab source code. Use wget
or curl with the URL to bring Git directly to your machine.
Compiling and installing Git manually
Extract: tar -xf
. Enter the directory and compile:
make prefix=/usr/local all
then
sudo make prefix=/usr/local install
Attention to detail is key.
Verifying installation and setting up Git
Once compiled, git --version
must show up as expected. Set up identities with commands for credentials. Completing the Git tapestry, ready for version control action.
Configuring Git After Installation
Setting Up User Credentials
Configuring global username and email
To personalize your version control experience, tell Git who you are. Open Terminal or Command Prompt. Enter these commands:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
These ensure each commit is tied to you. Identity in code matters.
Understanding the significance of user identity in commits
Each commit leaves a trace. Your name and email anchor your contributions, safeguarding credit and responsibility. Uniformity across projects is advisable—these are public records in open repositories.
Configuring Line Endings
Choosing the correct line-ending settings based on OS
Line endings vary: use Unix-style (LF
) for macOS and Linux, and Windows-style (CRLF
) for Windows. Configuring them right prevents chaos across environments.
Windows-style vs. Unix-style line endings
Git offers automatic conversion. Use:
git config --global core.autocrlf true
on Windows for automatic conversion to CRLF
, and set it to input
on Unix-based systems to maintain LF
.
Setting Up SSH Authentication for GitHub and GitLab
Generating an SSH key
Boost security with SSH keys. Generate one via:
ssh-keygen -t rsa -b 4096 -C "your.email@example.com"
Store it safely. Guard it like a secret.
Adding the SSH key to GitHub/GitLab
Upload the public key to GitHub or GitLab. Access your account settings, find SSH keys, and paste it. Secure connections enable peace of mind.
Testing SSH authentication
Verify with:
ssh -T git@github.com
or
ssh -T git@gitlab.com
A greeting or challenge indicates connection success.
Configuring the Git Credential Helper
Using credential storage for HTTPS authentication
To limit repeated logins, configure Git’s credential storage:
git config --global credential.helper store
Enabling credential caching on Windows and macOS
For practice, speeding up access. On Windows, enable with:
git config --global credential.helper wincred
And for macOS:
git config --global credential.helper osxkeychain
These make interactions faster, with security.
Verifying and Testing Git Installation
Checking Git Version
Running git –version in the command line
First, open Terminal or Command Prompt. Type git --version
. Press Enter. A version number means success. It’s the quickest way to check.
Ensuring Git is properly recognized in the system PATH
Sometimes recognition fails. If git --version
doesn’t respond, PATH issues might be lurking. Environment Variables need a nudge—Git’s directory must be in the list.
Creating a Test Repository
Initializing a new Git repository
Navigate to your chosen directory. Enter git init
. This command creates a .git
folder—your repository’s brain.
Making a test commit to verify functionality
Create a new file, add content. git add .
stages changes. Then git commit -m "Initial commit"
. A smooth commit confirms Git functions well.
Cloning an Existing Repository
Cloning a repository via HTTPS
Locate the repository URL. Use git clone https://example.com/repo.git
. The command copies it to your machine. Simple and effective.
Cloning a repository via SSH
Have SSH set up? Use git clone git@example.com:repo.git
. It’s fast, secure, for those with SSH keys configured.
Checking repository contents and commit history
Inside the cloned directory, explore. Use git log
to inspect commit history. Examine files with familiar commands like ls
or dir
.
Listing and Managing Remote Repositories
Viewing configured remote repositories
Type git remote -v
. This reveals the remotes tied to your repository. Insightful, quick to understand what’s connected.
Adding a new remote repository
To introduce a new remote, go with git remote add [name] [url]
. Handy for linking up another remote.
Removing or renaming remotes
Had enough of a remote? git remote remove [name]
. Need a fresh start? git remote rename [old-name] [new-name]
. Tools for clarity and order.
Working with Git in Different Interfaces
Using Git from the Command Line
Common Git commands (git status, git add, git commit)
Command line makes Git powerful. Type git status
to view changes. Add files with git add <filename>
. Commit changes with git commit -m "Your message"
. It’s the direct way to interact with your code. Clean, efficient.
Navigating branches and history
Switch branches using git checkout <branch-name>
. Or create a new one: git checkout -b <new-branch-name>
. Track history with git log
. Dive into commits; see how your project evolves. Command line gives you the controls.
Using Git with Graphical Clients
Overview of Git GUI tools (GitHub Desktop, Sourcetree, GitKraken)
Sometimes, visuals help. GitHub Desktop offers simplicity and elegance. Sourcetree throws everything at you—great for complex projects. GitKraken, with its rich interface, appeals to those who love color coding and drag-and-drop.
Managing repositories visually with Git GUI
Open the app. Clone repositories by clicking buttons. Drag files to stage them. Commits are a breeze. Sync with online repositories easily. With GUIs, it’s like getting a friendly assistant for repetitive tasks.
Integrating Git with Code Editors
Using Git inside Visual Studio Code
Visual Studio Code is smart. Built-in Git support. Your sidebar becomes a version control center. Stage, commit, push—all inside one window. Extensions enhance functionality—GitLens, anyone?
Configuring Git in JetBrains IDEs (PyCharm, IntelliJ, WebStorm)
PyCharm, IntelliJ, WebStorm—all JetBrains tools understand Git. Integrated VCS tools merge seamlessly. Set up is minimal; each IDE feels intuitive. Push, pull, merge—all visual, smooth, part of your flow.
FAQ on How To Install Git
What is Git and why should I install it?
Git is a version control system. It’s important for managing changes in code, especially when working on projects with others or tracking progress over time.
Installing Git allows you to easily track modifications, revert changes, and collaborate on repositories hosted on platforms like GitHub.
How do I install Git on Windows?
To install Git on Windows, visit the Git official website, download the Windows installer, and follow the setup wizard.
Opt for options like Git Bash for a command-line interface and line-ending conversions suited for Windows. Once complete, verify the installation by running git --version
in Command Prompt.
How do I install Git on macOS?
Mac users can install Git through Homebrew. First, ensure you have Homebrew installed. Then, open Terminal and type brew install git
.
This command downloads and installs Git seamlessly. You can verify if the installation was successful by executing git --version
, confirming Git’s presence.
How do I install Git on Linux?
For Linux, the process depends on your distribution. On Ubuntu, simply use sudo apt-get update
followed by sudo apt-get install git
. For Fedora, the command is sudo dnf install git
. Verify the installation using git --version
to confirm it’s set up correctly on your system.
What is a Git repository and how do I set it up?
A Git repository is a storage for your projects. Once Git is installed, you can initialize a repository by navigating to the project’s directory in Terminal or Command Prompt and running git init
. This command creates a .git
directory, allowing version control for changes in your project.
How do I configure Git after installation?
After installation, you need to set your identity for version control. Use git config --global user.name "Your Name"
and git config --global user.email "your.email@example.com"
.
This configuration commands Git to track your contributions accurately. These settings are crucial for team-based projects.
How do I connect Git to GitHub or Bitbucket?
To connect, you need an account on GitHub or Bitbucket. Create a repository on the platform, then clone it to your machine using git clone [repository URL]
.
To commit changes locally, use git add .
and git commit -m "message"
before pushing updates with git push origin master
.
How do I update Git to the latest version?
Updating Git varies per platform. Windows users should revisit the Git website and reinstall using the latest installer.
Mac users can run brew upgrade git
, while Linux users update via package managers, like sudo apt-get upgrade git
for Ubuntu users, ensuring they’re on the latest version.
What are common issues when installing Git, and how do I fix them?
Installation issues might include missing dependencies or incorrect path settings. For missing dependencies, update your system packages.
Permission errors demand running the installation as an administrator. Path issues can be fixed by ensuring Git’s path is in your system’s environment variables.
How can I verify my Git installation?
Verifying is simple. Open your Terminal or Command Prompt, type git --version
, and hit enter. The command should return the installed Git version number.
If it doesn’t, your installation might have issues, and you may need to revisit the setup or consult Git’s documentation for help.
Conclusion
Learning how to install Git brings you a step closer to mastering version control. By now, you should feel comfortable setting up Git across various operating systems, such as Windows, macOS, and Linux. Knowledge in configuring Git, managing repositories, and utilizing command-line tools ensures smooth software development.
Git, paired with platforms like GitHub or Bitbucket, extends collaboration possibilities and enhances project management. Now, installing and verifying Git is straightforward. Always remember to configure your user settings to track progress and contributions accurately.
With these tools integrated into your workflow, you’ll manage source code, collaborate effectively, and keep your projects under control. Embrace the power of Git to streamline your development process. As you continue, understand Git commands like git init
, git clone
, and git commit
. This skill is crucial in the evolving field of software development. Stay updated and practice to refine your expertise in using Git as a version control system.
- How to Install Git on Windows, Mac, and Linux - March 5, 2025
- How to Move a Channel on Roku for Easy Access - March 4, 2025
- How to Switch Branches in Git Easily - March 4, 2025