Git Installation
Installation Guide
Windows:
Visit git-scm.com, click "Download for Windows," and run the installer.
During installation, choose default settings unless specified otherwise.
Mac OSX:
Open Terminal and use Homebrew:
$brew install git.If Homebrew is not installed, follow instructions at brew.sh.
Linux:
Open Terminal and use your package manager. For Debian/Ubuntu:
$sudo apt install git.For Fedora:
$sudo dnf install git.
Verify Installation:
Open Terminal or Command Prompt.
Type
$git --versionto check if Git is correctly installed. You should see an output similar togit version 2.x.x.
Configure Git User Details:
Set your username:
$git config --global user.name "Your Name"Set your email:
$git config --global user.email "[email protected]"Verify your settings:
$git config --list
Sample Example:
Create a new directory:
$mkdirMyFirstRepo&& cd MyFirstRepoInitialize Git:
$git initCreate a sample file:
$echo "Hello, Git!" >README.mdStage the file:
$git add README.mdCommit the file:
$git commit -m "Initial commit"Student Activity:
Install Git on your system following the steps above.
Verify your installation and configure your username and email.
Initialize a new Git repository in a folder named
GitPractice.Create a file named
practice.txt, add some text, stage, and commit the file.Run
$git logto view your commit history.
By completing these steps, you'll have a basic understanding of installing and configuring Git, creating a repository, and making your first commit.
Last updated