How to Install Git on Windows and MacOs | day 08

There are three ways to install Git on Windows:

  • Using the Git installer. The GUI installer wizard is available on the official Git website and allows you to configure the Git installation step-by-step.
  • Using Winget. A Linux-style CLI package manager for Windows that simplifies app installations but offers fewer configuration options as it assumes all default options.
  • Using chocolatey

Choose your preferred installation method based on how much control you want over the installation process and your preference for using the GUI or CLI.

Install Git on Windows via GUI

The GUI method involves downloading the Git installer wizard from the official website and configuring the installation in a traditional Windows step-by-step manner. This approach is useful if you want full control of the installation process and do not like using the CLI.

Note: During the installation, Git prompts you to select a text editor. If you don’t have one, we strongly advise you to install it prior to installing Git. Our roundup of the best text editors for coding may help you decide.

Follow the steps below:

1. Navigate to the official Git downloads page and click the download link for the latest Git version for Windows:

Downloading the Git installer for Windows.

The link contains the latest 64-bit Git version for Windows. Alternatively, if you use a 32-bit system, download the 32-bit Git installer.

2. Double-click the downloaded file to extract and launch the installer.

3. Review the GNU General Public License, and when you are ready to install, click Next.

Accepting the GNU General Public License before installing Git on Windows.

4. The installer prompts you for an installation location. Leave the default one unless you want to change it, and click Next.

Select the installation destination for Git.

5. In the component selection screen, leave the defaults unless you need to change them and click Next.

Selecting the components for Git installation.

6. The installer offers to create a start menu folder. Click Next to accept and proceed to the next step.

Selecting the Git start menu folder.

7. Select a text editor you want to use with Git. Use the drop-down menu to select Notepad++ (or whichever text editor you prefer) and click Next.

If you prefer to use a CLI text editor in Git Bash, select nano or Vim from the list.

Choosing the default text editor for Git on Windows.

8. The next step allows you to choose a different name for your initial branch. The default is master. Unless you are working in a team that requires a different name, leave the default option and click Next.

Choosing the initial Git branch name during installation.

Note: If you are new to Git, check out our guides to Git branch name conventions and Git branching strategies.

9. The next step allows you to change the PATH environment. The PATH is the default set of directories included when you run a command from the command line. Keep the middle (recommended) selection and click Next.

Adjusting the PATH in Git for Windows.

10. The installer prompts you to select the SSH client for Git to use. Git already comes with its own SSH client, so if you don’t need a specific one, leave the default option and click Next.

Choosing which SSH client to use for Git.

Note: Check out our comparison of SSH and HTTPS for Git and which one you should use.

11. The next option relates to server certificates. The default option is recommended for most users. If you work in an Active Directory environment, you may need to switch to Windows Store certificates. Select your preferred option and click Next.

Choosing the HTTPS transport backend for Git.

12. The following selection configures line-ending conversion, which relates to the way data is formatted. The default selection is recommended for Windows. Click Next to proceed.

Configuring the line-ending conversion in Git.

13. Choose the terminal emulator you want to use. The default MinTTY is recommended for its features. Click Next to continue.

Selecting which terminal emulator to use for Git.

14. The next step allows you to choose what the git pull command will do. The default option is recommended unless you specifically need to change its behavior. Click Next to continue with the installation.

Selecting the default behavior of git pull.

15. The next step is to choose which credential helper to use. Git uses credential helpers to fetch or save credentials. The default option is the most stable one. Select your preferred credential manager and click Next.

Selecting the credential manager for Git.

16. The next step lets you decide which extra options to enable. If you use symbolic links, which represent shortcuts for the command line, tick the box. Keep file system caching checked and click Next.

Configuring extra options during Git installation.

17. Depending on which Git version you are installing, it may offer to install experimental features. At the time this article was written, the installer offered options to include support for pseudo controls and a built-in file system monitor. For the most stable operation, do not install experimental features and click Install.

Configuring experimental options for Git.

18. Once the installation is complete, tick the boxes to view the Release Notes or launch Git Bash if you want to start using Git right away, and click Finish.

Completing Git installation on Windows.

Install Git on Windows via CMD

Installing Git on Windows using the command line requires a working Winget installation, an Internet connection for the program to download the necessary files, and access to the Command Prompt or PowerShell.

If you prefer using a package manager for installing and managing programs, follow the steps below:

1. Press the Windows key and type powershell. From the results, select the Run as administrator option for Windows PowerShell.

Opening Windows PowerShell.

2. In PowerShell, run the following command to install the latest Git version:

winget install --id Git.Git -e --source winget

Installing Git on Windows using winget.

The command downloads and installs Git for Windows. It assumes all the default settings and completes the installation automatically.

How to Launch Git in Windows

Git has two modes of use – a bash scripting shell (or command line) and a graphical user interface (GUI). This section shows how to launch Git after installation.

Launch Git Bash Shell

To launch Git Bash, open the Windows Start menu, type git bash, and press Enter (or click the application icon).

Launching Git Bash on Windows.

Launch Git GUI

To launch Git GUI, open the Windows Start menu, type git gui, and press Enter (or click the application icon).

Launching Git GUI on Windows.

How to Check Git Version

To check which Git version is installed on your system, open the PowerShell and run the following command:

git --version

Checking which version of Git is installed on Windows.

The output shows which Git version is installed on the system.

How to Install Git on MacOs

There are several options for installing Git on macOS. Note that any non-source distributions are provided by third parties, and may not be up to date with the latest source release.

Choose one of the following options for installing Git on macOS:

Homebrew

Install homebrew if you don’t already have it, then:

brew install git

MacPorts

Install MacPorts if you don’t already have it, then:

sudo port install git

Xcode

Apple ships a binary package of Git with Xcode.

Binary installer

Tim Harper provides an installer for Git. The latest version is 2.33.0, which was released almost 3 years ago, on 2021-08-30.

Building from Source

If you prefer to build from source, you can find tarballs on kernel.org. The latest version is 2.45.2.

Installing git-gui

If you would like to install git-gui and gitk, git’s commit GUI and interactive history browser, you can do so using homebrew

brew install git-gui
mrcloudbook.com avatar

Ajay Kumar Yegireddi is a DevSecOps Engineer and System Administrator, with a passion for sharing real-world DevSecOps projects and tasks. Mr. Cloud Book, provides hands-on tutorials and practical insights to help others master DevSecOps tools and workflows. Content is designed to bridge the gap between development, security, and operations, making complex concepts easy to understand for both beginners and professionals.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *