How to Install Git on Windows?
How to download Git and Installation Guides for Windows step by Step?
To carry out operations with Git, we need to install it on our computer. Even if we have already had it on our system, it is recommended to update it to the latest version. The installation can be done as a package or via installers or from the official site of Git.
The following steps can be helpful in the purpose of installing Git.
- Visit the official site of Git for your Windows, macOS, or Linux system at https://git-scm.com/downloads.
- Check on the package below and see the latest version for your system.
- Click on the package. The download will be started any sooner.
- After downloading the installer file, the system performs a setup operation. Thus, keep proceeding with Next to continue.
- Default components are automatically selected. Click Next to continue.
- After doing this, it should display a path setup window. Click on the desired path whether you want to select Git Bash or Unix path. Although, the default-git command-line options are selected automatically. Proceed by clicking Next.
- The next window pops up which automatically selects 'Use of OpenSSL Library'. Click Next to continue.
- Keep clicking Next since the system automatically patches with the default recommended options.
- A new window is opened now. It shows 'Extracting Files'. After the extraction of all the files, the installation is complete. We have successfully installed Git. We can now access Git GUI and Git Bash.
Now, we can open the Git Bash application that will appear on our desktop. It looks similar to the Command-Prompt present on the system. We can now use our commands to push, merge, branch, or pull our files on Github.
Environment Setup
Any software needs proper environment setup for its execution, hardware configuration, and debugging the errors. It is an essential aspect of any software.
Git Config commands
Git lets you set and get configuration variables that control all the aspects of how it operates and looks through the command git config. It is generally used to configure values present at a local or global project level. The next step of configuration includes name and email commands that are done by the commands used ‘.name’ and user ‘.email.’ This can be done by following the steps shown below.
Setting username
$ git config --global user.name "Kundan Kumar Pathak"
Setting user-email
$ git config --global user.email "[email protected]"
There are many such operations associated with username settings. The above codes are the basic and most used commands.
Setting Editor
The users can choose their text editors to type the commands. For instance, we may use Vim for this.
$ git config --global core.editor Vim
After setting the editor, name, and email, we can see it in the form of a list stored in the system. To see this we need to type the command
$ git config -- list
The following output will appear which shows the directory or the location, name, and email associated with the configuration.
$ git config --list http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt http.sslbackend=openssl diff.astextplain.textconv=astextplain filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true credential.helper=manager core.autocrlf=true core.fscache=true core.symlinks=false pull.rebase=false user.name=Kundan Kumar Pathak [email protected]
Git Configuration levels
A configuration level defines the scope of the executable command on Git. It accepts the arguments to specify the configuration. Some of the configuration commands present in Git are as follows:
Local ( --local ): This is the default level in Git. If no configuration is given, Git will automatically configure locally. Values of this level are stored in the .git/config directory as a file.
System ( --system ): This is the level for total users present on a system. It acquires system-level configuration applied across the whole system. The files are stored in the gitconfig file of the system directory or C:\ProgramData\Git\config on Windows.
Global ( --global ): It is a user-specific configuration i.e. it is applied to an individual operating system user. Its values are stored in the ~ /.gitconfig on UN0IX systems and C:\Users\\.gitconfig on windows as a file format.