Git is a widely adopted source control system. It allows many small and large software projects to work in a very powerful way.
In this article, we will see a step-by-step guide to configuring windows environment for Git. Let’s start.
Step 1: Download Git for Windows
Go to the Git website. Download git. See the below screenshot.
Step 2: Configure Git on Local Machine
1] Open Git Bash. Go to All programmes – Git – Git Bash. See below Screenshot.
Git Bash is a command-line interface easy to work with Git. You can always use other command-line tools and user interface provided by Git. But bash is the more common one to use and it gives you full control and access to all Git Commands.
You will get the following screen.
2] Now, first we will configure Username. It is in the global config file. So, to edit that file and add username we will use the following command and hit Enter.
Note: In below commands, you can use your own values to configure.
$ git config –global user.name “Tutorial Funda”
Note: All Git commands start with git word.
You can see below screen if command gets successfully executed.
3] Let’s Configure Email now, type the below command and hit enter.
$ git config –global user.email “[email protected]”
You will get below screen after successful execution.
If you want to see the global editor then type this below command.
$ git config –edit –global
Set Environment Variable for Notepad++ in Windows 7
To open Notepad++ like cmd and traditional Notepad using the command line, you need to set Environment Variable for Notepad++. This is a required step Before configuring other things in Git.
- Go to the MyComputer/Computer. Right-click and select Properties.
- Go to Advanced System Settings. Click on Environment Variables.
- In users variables for win 7 select path and click on edit.
- In the variable value append below path. Click OK.
Note: Don’t forget to put ‘;’ in the end.
Note: Your Notepad++ path may differ according to the operating system you are using.
After that close the opened instance of Git Bash.
Again open it and type below command and hit enter. Notepad++ will get open.
4] So now, We will specify Notepad++ as our editor for Git. For that, we need to make changes in the global config file. Use below command and hit enter.
$ git config –global core.editor “notepad++ -multiInst -nosession”
In the above command, core.editor specifies the editor which we want to set. In the parameters, we have specified notepad++, –multiInst (New instance of notepad will get open every time), –nosession (Session will be blank at every instance)
Note: If the above command doesn’t work then just remove –global from command and try again. This would happen if your config file is stored in local config instead or global.
You can see in below screenshot, our setting is stored in Git config file.
Path – C:\Users\win7\.gitconfig
Note: Above path would not be an application for local and system Git config.
We are done with Git configuration for windows environment. In the upcoming articles, we will see how to work with Git and Github.