Git is a powerful version control system widely used for tracking changes in source code during software development. This guide will show you how to set up Git on your Windows machine.
1. Install Git for Windows
Git for Windows provides a command line and a graphical interface for managing Git repositories.
Install Git for Windows: 1. Visit https://git-scm.com/. 2. Download the installer for Windows. 3. Run the installer and follow the setup wizard. Make sure to select "Git from the command line and also from 3rd-party software". 4. Complete the installation.
2. Configure Git
After installing Git, you need to configure your user name and email address. These details will be used for commits.
Configure Git: 1. Open Git Bash (installed with Git for Windows). 2. Set your name: `git config --global user.name "Your Name"` 3. Set your email: `git config --global user.email "youremail@example.com"` 4. Verify your configuration: `git config --list`
3. Initialize a Git Repository
Now that Git is configured, let's create a new Git repository.
Initialize a Git Repository: 1. Navigate to your project folder in Git Bash. 2. Run the command: `git init` 3. This will create a new Git repository in your project folder.
4. Test Your Setup
After completing the steps above, Git should be successfully installed and configured. To test, create a file in your repository and commit it.