How to install git on windows 10

Learn how to install git.

Install git illustration

How to install Git on any OS

Git can be installed on the most common operating systems like Windows, Mac, and Linux. In fact, Git comes installed by default on most Mac and Linux machines!

Checking for Git

To see if you already have Git installed, open up your terminal application.

  • If you’re on a Mac, look for a command prompt application called «Terminal».
  • If you’re on a Windows machine, open the windows command prompt or «Git Bash».

Once you’ve opened your terminal application, type git version. The output will either tell you which version of Git is installed, or it will alert you that git is an unknown command. If it’s an unknown command, read further and find out how to install Git.

Install Git Using GitHub Desktop

Installing GitHub Desktop will also install the latest version of Git if you don’t already have it. With GitHub Desktop, you get a command line version of Git with a robust GUI. Regardless of if you have Git installed or not, GitHub Desktop offers a simple collaboration tool for Git. You can learn more here.

Install Git on Windows

  1. Navigate to the latest Git for Windows installer and download the latest version.
  2. Once the installer has started, follow the instructions as provided in the Git Setup wizard screen until the installation is complete.
  3. Open the windows command prompt (or Git Bash if you selected not to use the standard Git Windows Command Prompt during the Git installation).
  4. Type git version to verify Git was installed.

Note: git-scm is a popular and recommended resource for downloading Git for Windows. The advantage of downloading Git from git-scm is that your download automatically starts with the latest version of Git included with the recommended command prompt, Git Bash . The download source is the same Git for Windows installer as referenced in the steps above.

Install Git on Mac

Most versions of MacOS will already have Git installed, and you can activate it through the terminal with git version. However, if you don’t have Git installed for whatever reason, you can install the latest version of Git using one of several popular methods as listed below:

Install Git From an Installer

  1. Navigate to the latest macOS Git Installer and download the latest version.
  2. Once the installer has started, follow the instructions as provided until the installation is complete.
  3. Open the command prompt «terminal» and type git version to verify Git was installed.

Note: git-scm is a popular and recommended resource for downloading Git on a Mac. The advantage of downloading Git from git-scm is that your download automatically starts with the latest version of Git. The download source is the same macOS Git Installer as referenced in the steps above.

Install Git from Homebrew

Homebrew is a popular package manager for macOS. If you already have Homwbrew installed, you can follow the below steps to install Git:

  1. Open up a terminal window and install Git using the following command: brew install git.
  2. Once the command output has completed, you can verify the installation by typing: git version.

Install Git on Linux

Fun fact: Git was originally developed to version the Linux operating system! So, it only makes sense that it is easy to configure to run on Linux.

You can install Git on Linux through the package management tool that comes with your distribution.

Debian/Ubuntu

  1. Git packages are available using apt.
  2. It’s a good idea to make sure you’re running the latest version. To do so, Navigate to your command prompt shell and run the following command to make sure everything is up-to-date: sudo apt-get update.
  3. To install Git, run the following command: sudo apt-get install git-all.
  4. Once the command output has completed, you can verify the installation by typing: git version.

Fedora

  1. Git packages are available using dnf.
  2. To install Git, navigate to your command prompt shell and run the following command: sudo dnf install git-all.
  3. Once the command output has completed, you can verify the installation by typing: git version.

Note: You can download the proper Git versions and read more about how to install on specific Linux systems, like installing Git on Ubuntu or Fedora, in git-scm’s documentation.

Other Methods of Installing Git

Looking to install Git via the source code? Learn more here.

Contribute to this article on GitHub.

Get started with git and GitHub

Review code, manage projects, and build software alongside 40 million developers.

Sign up for GitHub

Sign in

Before you start using Git, you have to make it available on your computer.
Even if it’s already installed, it’s probably a good idea to update to the latest version.
You can either install it as a package or via another installer, or download the source code and compile it yourself.

Installing on Linux

If you want to install the basic Git tools on Linux via a binary installer, you can generally do so through the package management tool that comes with your distribution.
If you’re on Fedora (or any closely-related RPM-based distribution, such as RHEL or CentOS), you can use dnf:

$ sudo dnf install git-all

If you’re on a Debian-based distribution, such as Ubuntu, try apt:

$ sudo apt install git-all

For more options, there are instructions for installing on several different Unix distributions on the Git website, at https://git-scm.com/download/linux.

Installing on macOS

There are several ways to install Git on a Mac.
The easiest is probably to install the Xcode Command Line Tools.
On Mavericks (10.9) or above you can do this simply by trying to run git from the Terminal the very first time.

If you don’t have it installed already, it will prompt you to install it.

If you want a more up to date version, you can also install it via a binary installer.
A macOS Git installer is maintained and available for download at the Git website, at https://git-scm.com/download/mac.

Git macOS installer

Figure 7. Git macOS Installer

Installing on Windows

There are also a few ways to install Git on Windows.
The most official build is available for download on the Git website.
Just go to https://git-scm.com/download/win and the download will start automatically.
Note that this is a project called Git for Windows, which is separate from Git itself; for more information on it, go to https://gitforwindows.org.

To get an automated installation you can use the Git Chocolatey package.
Note that the Chocolatey package is community maintained.

Installing from Source

Some people may instead find it useful to install Git from source, because you’ll get the most recent version.
The binary installers tend to be a bit behind, though as Git has matured in recent years, this has made less of a difference.

If you do want to install Git from source, you need to have the following libraries that Git depends on: autotools, curl, zlib, openssl, expat, and libiconv.
For example, if you’re on a system that has dnf (such as Fedora) or apt-get (such as a Debian-based system), you can use one of these commands to install the minimal dependencies for compiling and installing the Git binaries:

$ sudo dnf install dh-autoreconf curl-devel expat-devel gettext-devel 
  openssl-devel perl-devel zlib-devel
$ sudo apt-get install dh-autoreconf libcurl4-gnutls-dev libexpat1-dev 
  gettext libz-dev libssl-dev

In order to be able to add the documentation in various formats (doc, html, info), these additional dependencies are required:

$ sudo dnf install asciidoc xmlto docbook2X
$ sudo apt-get install asciidoc xmlto docbook2x

Note

Users of RHEL and RHEL-derivatives like CentOS and Scientific Linux will have to enable the EPEL repository to download the docbook2X package.

If you’re using a Debian-based distribution (Debian/Ubuntu/Ubuntu-derivatives), you also need the install-info package:

$ sudo apt-get install install-info

If you’re using a RPM-based distribution (Fedora/RHEL/RHEL-derivatives), you also need the getopt package (which is already installed on a Debian-based distro):

$ sudo dnf install getopt

Additionally, if you’re using Fedora/RHEL/RHEL-derivatives, you need to do this:

$ sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi

due to binary name differences.

When you have all the necessary dependencies, you can go ahead and grab the latest tagged release tarball from several places.
You can get it via the kernel.org site, at https://www.kernel.org/pub/software/scm/git, or the mirror on the GitHub website, at https://github.com/git/git/releases.
It’s generally a little clearer what the latest version is on the GitHub page, but the kernel.org page also has release signatures if you want to verify your download.

Then, compile and install:

$ tar -zxf git-2.8.0.tar.gz
$ cd git-2.8.0
$ make configure
$ ./configure --prefix=/usr
$ make all doc info
$ sudo make install install-doc install-html install-info

After this is done, you can also get Git via Git itself for updates:

$ git clone git://git.kernel.org/pub/scm/git/git.git

Introduction

Git is a widely used open-source software tracking application used to track projects across different teams and revision levels.

This guide will show you how to install Git on Windows.

tutorial on Installing Git Windows

Prerequisites

  • Administrator privileges
  • Access to a command-line
  • Your favorite coding text editor
  • Username and password for the Github website (optional)

Steps For Installing Git for Windows

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

Note: If you are new to Git, refer to our post How Does Git Work to learn more about Git workflow and Git functions.

Download Git for Windows

1. Browse to the official Git website: https://git-scm.com/downloads
2. Click the download link for Windows and allow the download to complete.

Windows version on Git page to download

Extract and Launch Git Installer

3. Browse to the download location (or use the download shortcut in your browser). Double-click the file to extract and launch the installer.

 example Location where the Git file has been downloaded

4. Allow the app to make changes to your device by clicking Yes on the User Account Control dialog that opens.

Initiate the Git installation process by selecting Yes

5. Review the GNU General Public License, and when you’re ready to install, click Next.

Accept Git Terms of Use

6. The installer will ask you for an installation location. Leave the default, unless you have reason to change it, and click Next.

Select the location for the Git installation on windows

7. A component selection screen will appear. Leave the defaults unless you have a specific need to change them and click Next.

This screen allows you to select custom Git componenets to install.

8. The installer will offer to create a start menu folder. Simply click Next.

Create shortcuts in Windows Start Menu

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

choosing a text editor durring Git installation

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

Choose a name for your initial git branch.

11. This installation 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. Leave this on the middle (recommended) selection and click Next.

Adjust Git path enviorment

Server Certificates, Line Endings and Terminal Emulators

12. The installer now asks which SSH client you want 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.

Choose which SSH client to use in git.

13. The next option relates to server certificates. Most users should use the default. If you’re working in an Active Directory environment, you may need to switch to Windows Store certificates. Click Next.

server sertificate for Git to use selcted

14. The next selection converts line endings. It is recommended that you leave the default selection. This relates to the way data is formatted and changing this option may cause problems. Click Next.

Select line end conversions

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

Select MinTTY as default terminal emulator

16. The installer now asks what the git pull command should do. The default option is recommended unless you specifically need to change its behavior. Click Next to continue with the installation.

Choose what the git pull command does in git.

17. Next you should choose which credential helper to use. Git uses credential helpers to fetch or save credentials. Leave the default option as it is the most stable one, and click Next.

Choose a git credential helper.

Additional Customization Options

18. The default options are recommended, however this step allows you to decide which extra option you would like to enable. If you use symbolic links, which are like shortcuts for the command line, tick the box. Click Next.

Choose extra options during git installation.

19. Depending on the version of Git you’re installing, it may offer to install experimental features. At the time this article was written, the options to include support for pseudo controls and a built-in file system monitor were offered. Unless you are feeling adventurous, leave them unchecked and click Install.

Configure experimental git features.

Complete Git Installation Process

20. Once the installation is complete, tick the boxes to view the Release Notes or Launch Git Bash, then click Finish.

Git installation on Windows is done

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).

Launch Git Bash Shell

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

how to start Git bash from Windows

Launch Git GUI

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

initial Git GUI screen

Connecting to a Remote Repository

You need a GitHub username and password for this next step.

Create a Test Directory

Open a Windows PowerShell interface by pressing Windows Key + x, and then i once the menu appears.

Create a new test directory (folder) by entering the following:

mkdir git_test

An example of the PowerShell output.

Example of creating a test directory in Windows PowerShell.

Change your location to the newly created directory:

cd git_test

Note: If you already have a GitHub repository, use the name of that project instead of git_test.

Configure GitHub Credentials

Configure your local Git installation to use your GitHub credentials by entering the following:

git config --global user.name "github_username"
git config --global user.email "email_address"

Note: Replace github_username and email_address with your GitHub credentials.

Clone a GitHub Repository

Go to your repository on GitHub. In the top right above the list of files, open the Clone or download drop-down menu. Copy the URL for cloning over HTTPS.

Cloning a GitHub repository over HTTPS

Switch to your PowerShell window, and enter the following:

git clone repository_url

Important: In the example above, the command will clone the repository over HTTPS. Another option is cloning with SSH URLs. For that option to work, you must generate an SSH key pair on your Windows workstation and assign the public key to your GitHub account.

List Remote Repositories

Your working directory should now have a copy of the repository from GitHub. It should contain a directory with the name of the project. Change to the directory:

cd git_project

Note: Replace git_project with the actual name of the repository you downloaded. If it’s not working, you can list the contents of the current directory with the ls command. This is helpful if you don’t know the exact name or need to check your spelling.

Once you’re in the sub-directory, list the remote repositories:

git remote -v

Pushing Local Files to the Remote Repository

Once you’ve done some work on the project, you may want to submit those changes to the remote project on GitHub.

1. For example, create a new text file by entering the following into your PowerShell window:

new-item text.txt

2. Confirmation that the new file is created.

Create new text file in Windows PowerShell.

3. Now check the status of your new Git branch and untracked files:

git status

4. Add your new file to the local project:

git add text.txt

5. Run git status again to make sure the text.txt file has been added. Next, commit the changes to the local project:

git commit -m "Sample 1"

6. Finally, push the changes to the remote GitHub repository:

git push

You may need to enter your username and password for GitHub.

Note: You can remove a remote repository if the need for it no longer exists. To learn how, visit our guide How to Remove a Git Remote.

Conclusion

You now have a working installation of Git on your Windows system. After installing Git on your Windows, you might find helpful how to update Git. Use Git’s features to coordinate work among programmers on a project.

For Linux and MacOS installation guides, check out our articles on installing Git on Ubuntu,  CentOS and MacOS.

Learn the methods to install Git on Windows 11 or 10 using the command line and graphical user interface for the version control system.

GIT is a free version control software that allows you to split your project data into individual snippets. This makes it possible to work in a team and you can find your extensions or adjustments more easily.

It is an open-source tool that was developed for a Linux kernel project but later used by most of the developers. The key benefit is it allows multiple developers to work on the same project by having a local working copy of the complete repository. Further, the git allows track changes made to the code, lets developers undo them if something goes wrong, and also makes the code available for others. In addition to the local working copies of the developers, there are also remote repositories. The changes from your own repository can be made public via Git by “pushing” them to a remote repository. Because every developer has a copy of the complete project data, Git is a distributed version control system.

Using a “GIT server” (even if it is actually none) you have the following advantages:

  • Working in a team
  • Backup of the code
  • Track changes
  • Restore changes
  • More performant than folder structures
  • Clear if you work with it a little longer
  • Fast and memory-saving
  • Deploy project directly

Estimated reading time: 10 minutes

There are two easy ways to install the GIT on Microsoft operating systems. One is using the command terminal and the other with the help of a regular graphical user interface. Here we show you both.

#1st way: Install using the command line

1. Open Windows Terminal

Right-click on the Windows 11 Start Menu and select Terminal (Admin). This will open the Windows Terminal app to access PowerShell or CMD. However, Windows 10 users will have PowerShell (Admin) option instead the Terminal one.

Open Command terminal as Admin

2. Check Winget Command line

In the next step, we will run the Winget command to check it’s available on the system. It is a Microsoft Package manager to install applications easily on Windows 11 or 10 operating systems using the command line.

Note: Windows 11 will have it by default, however, old Windows 10 users may need to install it manually. Project GitHub link.

winget

Check winget availablity on Windows 11

3. Install Git using command on Windows 11 or 10

Well, as we apprised that Winget is a Windows Package Manager Client, hence let users easily install the GIT on our system. It just takes one command only. No need to visit any website and download some setup.

winget install Git.Git

command to install GIT on Windows 11 or 10

Once the installation is completed, you can check the version of the installed Git, using the given command:

git --version

Note: If you get the following error, close your command terminal and open it again then check the version.

git : The term 'git' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

#2nd method using GUI

4: Download GIT

Well, in this method we need to manually visit the Git website to download the setup and move further for the installation process. Visit the official Git website and download the 64-bit version.

Download Git for Windows 11 or 10

5. Install Git on Windows 11 or 10

Once you have downloaded the setup, double-click and execute it to start the installation process. The first window will show you the license details, simply click the Next button.

Note: We will take you through the important steps (settings) of the installation, the rest you can leave to default, and can complete the installation process by clicking on the NEXT button on the Wizard.

Aceept license open source

6. Select Destination

Next, select the folder where you want to install Git. Here you can install it in some other drive or location if you want. However, it is recommended to leave it as default and just click the Next button.

Git installation destination on Windows 11

7. Select components & Editor

Although all the essential components needed by Git are already selected, if you want to create a Desktop icon, Add a Git Bash profile to Windows Terminal, or let Git check daily updates then that can be selected here in this section. If you are not sure about all this, don’t worry, simply move forward and click on the Next button.

Select components to install

Soon, the installer wizard of Git will ask you to choose the default Editor, by default VIM will be selected but you can choose the one you prefer from its drop-down list. Here we are selecting the default Notepad of Windows.

Select Code Editor for Git on Windows

8. Default Terminal

Git Bash by default will use MinTTY as a terminal emulator, which works great. However, for a more native feel, you can use the Windows Terminal. It’s all on you, what you prefer.

Default Console for Git

Followed the wizard further and complete the installation while leaving the settings as default.

Once the installation is completed, close and open your terminal again. Now you can access the Git command tool to check its version, type:

git --version

9. Update Git

In future, if you want to install the the update version of the Git then open the command terminal and just type the given commnad and it update the Git. It is applicable for both CLI and GUI installations.

git update-git-for-windows

10. Launch Git in Windows

Once you have this open source Version control system on your PC, to use it, we can use the our command prompt, Git Bash or Git GUI.

For Git Bash

Those who want to use the default bash of Git, go to start menu and there search for Git bash as it appears, click to run the same. This will give you the command line access.

Git Bash Windows

For Git GUI

Another way is to use the graphical user interface get installed automatically on your PC wiht the main installation. To access, on start menu run Git GUI.

Install Git on Windows 11 or 10 using command terminal
Git GUI

11. Clone the remote Github repository

Let’s use the PowerShell to clone the remote repository.

git clone remote-repository-url

12. Add GitHub account

To push your project to GitHub, we first need to set our account details.

For that, on your terminal or command prompt use the given commands. Repalce the username and email address with you GitHub credentials.

git config --global user.name "github_username"
git config --global user.email "email_address"

First of all create a folder where you want to clone the remote Github repository.

Create a directory

mkdir test

Switch to the folder

cd test

Intialize the Git

Now, intialize the git in the swtiched folder

git init

Add your files:

Let’s say you want to add some project files, for example create a text file.

notepad test.txt

Add the content and save the file.

Check the status, wether the Git knows about our added file or not.

git status

You can see Git is aware of file but has not been added to GitHub repository. For that we have to stage, commint push it.

Stage the file, it means you are preparing the file to commit

git add test.txt

If you have mutiple files and want add all of them, use:

git add --all

Commit keeps tracks of our progress and changes. Git consider it as a “save point

git commint -m "my project"

13. Uninstall Git from Windows 11 or 10

There would be a time when you don’t require the Git installation on your Windows 10 or 11 any more, at that time use command terminal and run the following command.

winget uninstall Git.Git

Alternatively, we can use the Windows Control panel to remove this software. Go to Start menu and type control panel, as its icon appears click to open it. Under the Control panel, click on “Uninstall a Program” -> select Git and hit the Uninstall button.

Uninstall Git from Windows 11 or 10

FAQ

How do I install Git on Windows?

We can install Git on Windows either using the command terminal package manager called “Winget” or using the GUI setup. For the second one we have to download latest Git for Windows installer from its official website.

Can I install Git via the command line on Windows?

Yes, we can install Git via the command line on Windows 11 or 10. Just open your Windows Termian (Admin) and run the given command:
winget install Git.Git

How do I know if Git is installed Windows?

To know Git is installed on your Windows, open the command terminal or prompt and check its verison using the following syntax:
git --version

Can we install Git without admin rights?

Yes, we can install git on Windows without adminsitrative rights and for it you just need to run its installation setup without Admin privileges.

Понравилась статья? Поделить с друзьями:
  • How to install gcc on windows 10
  • How to install openssl on windows
  • How to install games for windows live
  • How to install fonts on windows 10
  • How to install font to windows