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 --version to check if Git is correctly installed. You should see an output similar to git 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: $mkdir MyFirstRepo && cd MyFirstRepo

    • Initialize Git: $git init

    • Create a sample file: $echo "Hello, Git!" > README.md

    • Stage the file: $git add README.md

    • Commit 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 log to 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