Git Getting Started
Git Install
You can get Git at no cost by visiting: Download Fro Here
Working with Git in the Terminal
Start by making a fresh folder for your project.
- Windows users can access Git Bash, which comes bundled with Git for Windows.
- Mac and Linux users can work with the built-in Terminal.
First, verify that Git is installed by running:
git --version
Example Output:
git version 2.30.2.windows.1
If Git is installed, you'll see a version number similar to git version X.Y.Z.
Setting Up Git Credentials
Before using Git, configure your identity. This ensures that every commit is associated with the correct user.
Execute these commands to configure your username and email:
git config --global user.name "your-username" Git config --global user.email "your-email@example.com"
Replace "your-username" and "your-email@example.com" with your actual details.
The --global flag applies these settings to all repositories on your system.
To configure only the current project, omit –global.
You'll also need these credentials when linking Git with platforms like GitHub.
Setting Up a Git Project Folder
To begin, create a new directory for your project:
mkdir myproject Cd myproject
- mkdir generates a new folder.
- cd moves into that folder.
Now that you're inside the correct directory, it's time to initialize Git!
Already have an existing folder?
Access it through the terminal or locate it in your file manager.
On Windows, open the folder, right-click, and choose "Git Bash Here" to launch Git.
Starting a Git Repository
Once inside your project folder, initialize Git by running:
git init
Example Output:
Initialized empty Git repository in /Users/user/myproject/.git/
Congratulations! Your first Git repository is ready!
Git is now tracking this folder for changes.Previous Next
A hidden .git directory has been created to store version history and configurations.