Git Installation on Windows
Installing Git on Windows
This guide walks you through installing Git on your Windows PC for use with RStudio and GitHub.
!! At LJMU managed computers, install Git either from Company Portal or App Player (older).
- Download the Installer
- Visit the official Git website: https://git-scm.com/downloads.
- Click the “Windows” link to download the latest stable
.exeinstaller.
- Run the Installer
- Locate the downloaded
.exefile (e.g.,Git-2.xx.x-64-bit.exe) and double-click to start the installation wizard.
- Locate the downloaded
- Follow the Installation Wizard Prompts
- License: Click
Next. - Select Components: Accept defaults, ensuring “Git Bash Here” and “Git GUI Here” are checked. Click
Next. - Installation Location: Use the default location unless needed otherwise. Click
Next. - Start Menu Folder: Accept the default. Click
Next. - Adjust PATH Environment: Critical for RStudio. Select:
- “Git from the command line and also from 3rd-party software”
- Click
Next.
- Default Branch Name: Use
mainfor new repositories. ClickNext. - HTTPS Backend: Choose “Use the OpenSSL library” (recommended). Click
Next. - Line Ending Conversions: Select “Checkout Windows-style, commit Unix-style line endings” for cross-platform compatibility. Click
Next. - Terminal Emulator: Choose “Use MinTTY (default Git for Windows terminal)”. Click
Next. - Default
git pullBehavior: Select “Default (fast-forward or merge)”. ClickNext. - Credential Helper: Choose “Git Credential Manager Core”. Click
Next. - Extra Options: Accept defaults. Click
Next. - Experimental Options: Uncheck unless needed. Click
Install.
- License: Click
- Finish Installation
- Click
Finishwhen complete. Uncheck “View Release Notes” if desired.
- Click
- Verify Installation in RStudio
Important: Close and reopen RStudio (or its terminal pane) to update the PATH environment variable.
Open a new terminal in RStudio:
Tools > Terminal > New Terminal.Type
git --versionand press Enter. You should see the Git version (e.g.,git version 2.45.2.windows.1).! If you want to copy and paste, but it doesn’t work with Ctrl + V or Cmd + V, use Shift + Insert, or Edit->Paste
If an error occurs, restart your computer and retry
git --version.
RStudio, Git, and GitHub Workflow
To use Git and GitHub with RStudio, follow these steps:
- Start/Update Project: Create or update an RStudio project locally.
- Edit Code: Write or modify R code in RStudio.
- Save & Stage: Save changes and stage them with
git add. - Commit Changes: Commit staged changes with
git commit. - Push to GitHub: Push commits to a GitHub repository with
git push. - Sync with GitHub: Ensure the GitHub repository reflects local changes.
- Pull Changes: Pull updates from GitHub with
git pull.