Swiftorial Logo
Home
Swift Lessons
Matchups
CodeSnaps
Tutorials
Career
Resources

Git & GitHub - Git Installation

Steps to install Git on different operating systems

Installing Git is a straightforward process that varies slightly depending on your operating system. This guide provides step-by-step instructions for installing Git on Windows, macOS, and Linux.

Key Points:

  • Git can be installed on Windows, macOS, and Linux.
  • Each operating system has specific installation commands and steps.
  • After installation, Git can be configured to optimize your workflow.

Installing Git on Windows

Follow these steps to install Git on a Windows system:

  • Download the Git installer from the official Git website: git-scm.com.
  • Run the installer and follow the setup instructions.
  • During the installation, you can choose default options or customize the settings according to your preferences.
  • Once the installation is complete, open the Command Prompt and verify the installation by typing:

$ git --version
                

Installing Git on macOS

Follow these steps to install Git on a macOS system:

  • Open the Terminal.
  • Use the following command to install Git using Homebrew (if you do not have Homebrew installed, first install it from brew.sh):

$ brew install git
                
  • Once the installation is complete, verify the installation by typing:

$ git --version
                

Installing Git on Linux

Follow these steps to install Git on a Linux system. The commands may vary depending on your distribution.

Debian/Ubuntu-based distributions:


$ sudo apt update
$ sudo apt install git
                

Fedora-based distributions:


$ sudo dnf install git
                

Arch-based distributions:


$ sudo pacman -S git
                

After installation, verify the installation by typing:


$ git --version
                

Configuring Git

After installing Git, it is important to configure it to optimize your workflow. The first step is to set your user name and email address. These details will be associated with your commits.


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

You can verify your configuration with the following command:


$ git config --list
                

Summary

This guide covered the steps to install Git on Windows, macOS, and Linux, as well as the initial configuration to get you started. Proper installation and configuration of Git are crucial for efficient version control in your development projects.