In this article, we will see how to install Git (the distributed version control system) on Windows Operating System.
There are over 15 steps that need to be followed to get Git for Windows (Git Bash) installed and a student who is about to start learning git may feel a bit lost, so I have tried to put down each step and walk-through what option you can select while the installation,
Steps to install Git on Windows
- First, you need to download the Git Setup from Official Git Website: https://git-scm.com/ and click on the Monitor link that says "Latest Source Release"
Step 1 - Download Git Setup for Windows
The current version I have downloaded is 2.29.2, you can also check the release notes to see what's new,
Git v2.29.2 Release Notes ========================= This release is primarily to fix brown-paper-bag breakages in the 2.29.0 release. Fixes since v2.29.1 ------------------- * In 2.29, "--committer-date-is-author-date" option of "rebase" and "am" subcommands lost the e-mail address by mistake, which has been corrected.
- Now once you have download the setup, double-click on the exe file: Git-2.29.2.2-64-bit.exe,
- You would see a screen that says,
User Account Control
Do you want this allow this app to make changes to your devices?Click on yes!
- Now you should see the setup window:GNU General Public License, read it and click Next,
- Selet the Components that you want to be installed or ignored, you can keep it the default - but if you want to keep Git up-to-date you can check "Check daily for Git for Windows updates" option. Click Next,
- Here, Choose the default text editor for Git - you can choose from various options like Nano, Vim, Notepad++, Visual Studio Code (VS Code), Sublime Text, Atom or select some other by browsing, I choose Notepad++, Click Next,
- Adjusting the name of the initial Branch in new repositories:
If you go a git init as we know the default branch that's created is master, if you wish to change that to something like main, trunk, development, or any custom name you can select Override the default branch. Click Next,
- Adjust your Path Environment:
Here you will get three options,
- Use Git from Git Bash Only: If you select this the PATH environment variable will not be changed and you can only use the Git command using the Git Bash tool.
- Git from Command Line and 3-party Softwares: This is recommended. This will let the git command run from CMD and Powershell as well as 3-party tools.
- Use Git from optional Unix tools from the Command Prompt: This is not recommended as it messes with Windows CMD commands like find and sort, click Next.
- Choosing HTTPS transport backend: I kept this as default, Next,
- Configure the line ending conversions:
As a developer, you must be aware that most EOL Encoding issues - CRLF, CR, or LF that arise while working with cross-platforms. Writing code on Windows/macOS, deploying on Unix. So choose the option according to your use-case or leave it to default, Next,
- Choose the Terminal emulator to use with Git Bash: You can keep it default, Next
- Choose the default behavior of git pull: Choose the default option, Next
- Choose a credential helper: Choose the Git Credential Manager Core, Note Git Credential Manager is deprecated, Next,
- Configure Extra Options: You can keep this one as default as well "Enable file system Caching", Next,
- Configuring experimental options: This is a new feature, you can enable it if you do Node or Python development. Click Finish
⛏️ If you are looking for an older and specific version release of git then you can get them from GitHub: https://github.com/git-for-windows/git/releases, you can find 32-bit, 64-bit, Portable Git as well as the source code here.
How to test Git after installation:
Type Git Bash in Windows search and open it, try the below commands,
$ git --version
git version 2.21.0.windows.1
$ mkdir my_git_repo
$ git init
Initialized empty Git repository in C:/Users/c2c/.git/
c2c@LAPTOP-XXXX MINGW64 ~ (master)
Have Questions? Post them here!
- Fix [oh-my-zsh] Cant update: not a git repository
- [fix] fatal: pathspec index.html did not match any files error
- How to ignore files in git using .gitignore file
- Git Fix: fatal: refusing to merge unrelated histories Error
- Install GitHub Command Line Tool on Mac
- How to change directory in Git bash
- Get List of all local branches git command
- fix fatal: --local can only be used inside a git repository error
- [git] fatal: your current branch 'main' does not have any commits yet
- Git Revision Questions Before the Interview
- Change the default git branch name from master to main
- git command to remove/unstage files from staging area
- Remove git config at Local, Global or System Levels?
- [fix] fatal: this operation must be run in a work tree in git
- Clone a particular remote brach using git clone command
- How do I get a list of all branches in Git?
- How to check your installed version of Git
- Step-by-Step: How to delete a git branch from local as well as remote origin
- Git Commit - Author identity unknown, Please tell me who you are email
- fatal: Unable to create '/c/git_repo/.git/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier.
- How to Rename a Git Local Branch Using the --move Option
- Perform an Empty Commit in Git without anything in Staging Area
- [Fixed] Git Clone git@github.com: Permission denied (publickey) Could not read from remote repository Fatal error
- GitHub: How to Search Code
- Rename git branch on Local and GitHub Remove using Command
- Configure AWS Access ID and Secret Keys using CLI on Mac - AWS
- [Solutions] Android Error in an XML file: aborting build. Eclipse SDK - Android
- How to connect to Microsoft Exchange Online using PowerShell - Powershell
- How to use Autocomplete and Autosuggestion in Shell Commands - Bash
- 16: Find the largest element in a List - 1000+ Python Programs - Python-Programs
- How to reset Eclipse IDE Code Font - Eclipse
- How to create SharePoint List Item programmatically using C#.net - SharePoint
- Docker MySQL Compose File with Volume Example - Docker