Windows · Guide

How to Install Git on Windows and Set It Up Correctly

Short answer

Install Git for Windows from git-scm.com, keep Git Credential Manager enabled, then set your name and email with git config --global. Choose the checkout-as-is line-ending option if you work with teammates on other platforms.

Requirements

  • Windows 11 or Windows 10
  • Git for Windows installer
  • A repository host account if you plan to push
  • Optional: GitHub Desktop for a graphical client

Steps

  1. 1. Download the official installer

    Get Git for Windows from git-scm.com. It includes the Git command line, Git Bash and Git Credential Manager in one package.

  2. 2. Choose the default editor

    Pick an editor you actually know — VS Code or Notepad++ — rather than leaving Vim as the default, or your first commit message will be confusing.

  3. 3. Set the line-ending policy deliberately

    Checkout as-is, commit Unix-style line endings is the safest option for cross-platform teams. The default conversion setting can create diffs where nothing really changed.

  4. 4. Keep Credential Manager enabled

    Git Credential Manager stores tokens securely and handles browser-based sign-in, which is required now that password authentication is gone from major hosts.

  5. 5. Identify yourself

    Run git config --global user.name "Your Name" and git config --global user.email "[email protected]". Commits made before this show the wrong author and are awkward to fix.

  6. 6. Set the default branch name

    git config --global init.defaultBranch main matches what most hosts expect for new repositories.

  7. 7. Clone and verify

    Run git clone <url>, make a small change, then git status and git log --oneline. Working output confirms Git, credentials and networking are all correct.

Alternative methods

  1. 1. Use GitHub Desktop

    GitHub Desktop installs its own Git and handles cloning, branching and pull requests graphically, which is enough for many everyday workflows.

  2. 2. Install with winget

    winget install --id Git.Git installs the same official package non-interactively, using the default options.

Troubleshooting

git is not recognized as a command

The installer's PATH option was set to Git Bash only. Re-run the installer and choose the recommended option that adds Git to the system PATH.

Every file shows as modified after cloning

Line-ending conversion rewrote the working copy. Set core.autocrlf to false, or add a .gitattributes file to the repository to normalise it for everyone.

Authentication fails when pushing

Password authentication is no longer accepted by major hosts. Use a personal access token or let Credential Manager complete browser sign-in.

Frequently asked questions

Do I need Git if I use GitHub Desktop?

No, GitHub Desktop bundles Git. Installing Git for Windows as well gives you the command line and Git Bash, which most guides assume.

What is Git Bash for?

It provides a Unix-style shell on Windows, so commands from documentation written for Linux or macOS work unchanged.

How do I update Git on Windows?

Run git update-git-for-windows, or reinstall from the current installer. Your configuration and repositories are preserved.

Can I use SSH keys instead of tokens?

Yes. Generate a key with ssh-keygen, add the public key to your host account, and clone using the SSH URL.

Reviewed by SoftNexi Editorial Team

Last verified: September 8, 2026