Installing Git Version Control

Author
Affiliation

Prof. J Babiera and Prof. R Cuenca

Center for Computational Analytics and Modelling (CCAM), PRISM, MSU-IIT

To install a Git version control, go to the download pages for Git:

Windows OS

For Windows OS, select the appropriate bit-type of your Windows system. In my case, 64-bit is used.

Just run the *.exe (as of April 14, 2025 4:25 AM, the latest 64-bit installer is Git-2.49.0-64-bit.exe). Follow installation guide with the following recommended configuration:

  1. Select Components:
    • Keep default selections.
    • Optionally, enable:
      • “Windows Explorer integration”
      • “Git Bash Here”
      • “Git GUI Here”
  2. Choosing the Default Editor:
    • Select an editor you’re comfortable with.
    • Common choices:
      • Nano: Simple and user-friendly.
      • Notepad++: Feature-rich and widely used.
      • Visual Studio Code: Modern and extensible.
  3. Adjusting the Name of the Initial Branch:
    • Set to main to align with modern conventions:
      • “Override the default branch name for new repositories” → main
  4. Adjusting Your PATH Environment:
    • Choose:
      • “Git from the command line and also from 3rd-party software”
    • This allows Git to be used in various terminals and tools.
  5. Choosing the SSH Executable:
    • Select:
      • “Use bundled OpenSSH”
    • Ensures compatibility with Git operations.
  6. Choosing HTTPS Transport Backend:
    • Opt for:
      • “Use the OpenSSL library”
    • Provides broader compatibility across environments.
  7. Configuring the Line Ending Conversions:
    • Select:
      • “Checkout Windows-style, commit Unix-style line endings”
    • This setting helps maintain consistency across different operating systems.
  8. Configuring the Terminal Emulator:
    • Choose:
      • “Use MinTTY (the default terminal of MSYS2)”
    • Offers a better terminal experience with features like copy-paste and resizable windows.
  9. Configuring Extra Options:
    • Enable:
      • “Enable file system caching”
      • “Enable symbolic links” (if you plan to use symlinks)
  10. Experimental Options:
    • It’s advisable to leave experimental features unchecked unless you have specific needs.

Post-Installation Configuration

After completing the installation:

  1. Set Your Identity:
    • Open Git Bash within RStudio using the keyboard shortcut Shift + Alt + M and configure your user information:

      git config --global user.name "Your Name"
      git config --global user.email "you@example.com"
  2. Verify Installation:
    • Check the installed Git version:

      git --version

These settings provide a balanced configuration suitable for most users, ensuring compatibility and ease of use across various development environments.

Mac OS

To install Git on macOS using the Terminal, you have several options:

Option 1: Install Git via Xcode Command Line Tools

macOS includes Git as part of the Xcode Command Line Tools. You can install it as follows:

  1. Open Terminal:
    • Navigate to Applications > Utilities > Terminal.
  2. Check for Git Installation:
    • Type the following command and press Return:

      git --version
    • If Git is not installed, a prompt will appear asking if you want to install the Command Line Tools.

  3. Install Command Line Tools:
    • In the prompt that appears, click Install to proceed.
    • Agree to the License Agreement and wait for the installation to complete.
  4. Verify Installation:
    • After installation, verify that Git is installed by typing:

      git --version
    • You should see the Git version displayed, confirming the installation.

Option 2: Install Git Using Homebrew

Homebrew is a popular package manager for macOS that simplifies software installation. If you have Homebrew installed, you can install Git as follows:

  1. Open Terminal:
    • Navigate to Applications > Utilities > Terminal.
  2. Install Git:
    • Type the following command and press Return:

      brew install git
    • Homebrew will download and install Git.

  3. Verify Installation:
    • After installation, verify that Git is installed by typing:

      git --version
    • You should see the Git version displayed, confirming the installation.

What’s Next?