How to install Git on Windows example
As distributed version control systems continue to supplant centralized systems like Subversion and CVS, more and more developers have made the move toward SaaS-based version control platforms such as GitHub, GitLab and BitBucket. Of course, these are all Git based systems, which means developers must first locally install Git on Windows or Linux computers to interact with them.
In this Git tutorial, we will demonstrate how to install Git on Windows. We will then use the five basic Git commands every developer should know to verify that the DVCS tool was installed successfully.
Steps to install Git on Windows
Here are the steps to follow to install Git on Windows:
1. Download the executable Git file from git-scm.com/downloads
2. Run the installation file with Administrator rights
3. Choose an appropriate installation location such as C:\_tools\git
4. Install the default components, including Git GUI Here and Git Bash Here
5. Choose your preferred Git default editor. We recommend Notepad++.
6. Allow Git to be added to the Windows PATH
7. Accept the default line ending conversion for Unix and Windows compatibility
8. Chose the extra option to enable system caching
9. Click Finish to complete the install.
10. Choose to open a Git Bash shell and start using Git!
Test the Windows Git install
You can test the veracity of your Windows Git install by issuing the five basic Git commands every developer should know. Those basic Git commands are:
- init
- add
- config
- status
- commit
Before you run Git init, first create a new folder named repos off the C:\ drive:
[email protected] MINGW64 /c/repos $ git init Initialized empty Git repository in C:/repos/.git/
In the newly created folder, add a file named windows-git-install.txt:
[email protected] MINGW64 /c/repos $ touch windows-git-install.txt
Then add the file to the Git index:
[email protected] MINGW64 /c/repos $ git add .
Configure the Git user’s email address and username:
[email protected] MINGW64 /c/repos $ git config --global user.name "Cameron McKenzie"
[email protected] MINGW64 /c/repos $ git config --global user.email "[email protected]"
Commit the new file to the new Git repository:
[email protected] MINGW64 /c/repos $ git commit -m "New Windows git install commit" [master (root-commit) 5b8f1f4] New Windows git install commit 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 windows-git-install.txt
And finally, check the status of the newly installed Git repo:
[email protected] MINGW64 /c/repos $ git status On branch master nothing to commit, working tree clean
Thus concludes the task to install Git on Windows, and ensure that the DVCS tool is properly configured to manage source code and interact with SaaS-based tools such as GitHub, GitLab and BitBucket.