How To Install And Use Git On Windows End to End
Published: 2020-06-27 18:54:57

By the end of this article, you will be able to install and setup GIT SCM with your repository (GIT/Bitbucket) and will be able to Commit and Push the changes from local.

##GIT:
Git is a distributed version control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

##GITHUB Installation
Install GIT SCM from here: https://git-scm.com/download/
Select all defaults until this point
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/xhc253mnwavia4hbrk5u.png)

Click Next and Select Start Folder, again Click Next. On Next Window select Git’s default window:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/49lyj4f0o1vhofmn9ftw.png)

The next window 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 select Recommended settings and click Next
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uto5ctz2pch86iljcxg5.png)

Most users should use the default. But if you’re working in an Active Directory environment, you may need to switch to Windows Store certificates. Click Next.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/q7a3qqqyt6zr4kjn9o10.png)

This step is for data formatting, leave it as default and click Next
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8u7xvy3is0o8n7hvh8dt.png)

Choose the Terminal you want to use, the default MinTTY is recommended for its features. Click Next.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/p6ceil704zq254kzxokf.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/e8o4ljvlxrs14rvio8ts.png)

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. Default is recommended then Click Next.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/if7hil08yflyc2tleq45.png)

Depending on the version of Git you’re installing, it may offer to install experimental features. At the time this article was written, the option to include running native console programs like Node or Python in a GitBash window without using winpty was offered but it still had some bugs. Unless you are feeling adventurous, leave them unchecked and click Install.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/2zbknxj9a271de1jlam6.png)

After Installation, Launch GIT Bash
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nho9037hqa788ehcqvfu.png)

##Git has two modes -
A Bash Scripting Shell (or command line) and a Graphical User Interface (GUI). To launch either of those you can search in the Windows start menu or you can right-click anywhere on the screen to see below options.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f76qh3ga6mqvj0exukwn.png)

##GIT Setup:
If you are in an organization, you have to install below trust certificates (if you setting up on personal machine you skip this part and can Jump to commands)
Download and double click to install — curlt-ca-bundle.crt in the path where GIT is installed.
For eg: C:\Users\sahil.tiwari\AppData\Local\Programs\Git\mingw64\ssl\certs
And the cacerts file into the Java folder For eg: \ProgramFiles(x86)\Java\jre1.8.0_121\lib\seccurity
with the admin’s permission.
Then open GIT Bash and run following commands, commands to be given in GIT Bash for initial configuration.

git config — global user.name “sahil.tiwari”
git config — gloabal user.email sahil@example.com
git config — global http.sslCAInfo C:\Users\sahil.tiwari
git config — list
git config — list — global
git config — global http.sslverify false

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/yuajtrsoq71n39u41lih.png)

After the configurations open Git GUI and select Clone Existing Repository
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jykriybqflcq4pnqshv6.png)

Now give the Bitbucket/GIT path for your project in the source repository.
For example: https://bitbucket….
or
https://github.com/sahil…..
You can get source repository URL from bitbucket-> clone (Remove the username and @ from the URL) or if you are using GIT you can go to GIT and click on Clone and copy the path.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/psfgawsqogd748czw42t.png)

In GIT GUI, target repository is the local repository where you want the local copy (it will create a new folder where you select the path)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/u2dq7u9sic9kkyu8jm8q.png)

Then click on Clone
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1e4xhwjeigyqsx22nn3f.png)

Now go to Branch and click on Create.
Now select the Branch Name as “Match Tracking Branch Name”
Then select the Starting Revision as “Tracking Branch” and select the branch in which you want to push the code and click on Create
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8n4is4fepsz3clb3q5lg.png)

After you create local repository all the files present in the cloud repository will come in the local folder
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ao7zfbxa0qk6bq4dxr6m.png)

Then paste the files in the local repository that you want to add to the Global Repository.
Come back to GIT GUI and click on Rescan
You will find that the new files are present in the “Unstaged Changes” area. Click on the files to move them to “Staged Area”
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rys8ctav9xcfbcb7inbc.png)

Now give the Commit Message and click on Commit
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7tqo631uhljale3she4m.png)

Then click on PUSH to push the code to the global repository (it may ask GIT username and password for authentication)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/j0x3ta0iht25279pizhe.png)

Now go to your Bitbucket/GIT repository to check pushed changes are reflected or not.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f1zpc0qmxuo9movs0qqo.png)