Git for Windows installs the Git command and Git Bash. The git command also runs in PowerShell, but Bash and PowerShell do not use the same shell syntax. Keep that distinction clear while checking the installation and initial settings.
This article is based on a local account in Windows 11. If installation rights or package sources are restricted on company PCs, follow your organization’s distribution policy. There is no verification record of running the Windows installation screen directly, and the commands and selections are explained based on the official distribution documentation.
Git · GitOps All Series · 02 / 24
On this page
1. Install Git for Windows
Verify that Windows Package Manager is available in PowerShell. If you do not have winget, use the installer from Git for Windows official site . There is no separate installation tool required as shown in the search ad.
winget --version
winget show --id Git.Git --exact --source winget
winget install --id Git.Git --exact --source winget
Install after checking the package ID, publisher, and installation source in show. If you’re using the interactive installer, choose the editor you’re familiar with, and the PATH entry choose the option to use Git from the command prompt and other tools as well. If you haven’t decided on an editor, you can start with the default and change it later.
After installation, close the PowerShell window and open a new one. Existing processes may not receive the changed PATH.
git --version
Get-Command git
where.exe git
If you see multiple paths, check which Git runs first with Get-Command git. If other development tools are mixed with the installed Git, check the PATH and unify the settings based on the path that operates normally.
2. Enter the name and email to be recorded in the commit.
Replace the name and email below with your own values. This value is the commit’s creation information, not the server login password. Since your email may be public in a public repository, you can also use the private email provided by the service.
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
git config --global --get user.name
git config --global --get user.email
git config --show-origin --get init.defaultBranch
If you use a different email in your company project, enter the same settings without --global in the repository. Local settings in the repository take precedence over global settings. If you add --show-origin, you can see which file the value was read from.
3. Open the common practice in Git Bash.
Open Git Bash from the Start menu and run the command below. In Git Bash, C:\Users on Windows looks like /c/Users. If the path contains spaces, surround it with quotes.
mkdir -p ~/git-lab
cd ~/git-lab
pwd
git --version
The Bash examples containing cat <<'EOF', printf, and $변수 in this series are run in this window. PowerShell has different syntax, such as Get-Content and here-string, so pasting as is may fail. Git’s own options status, add, and commit are identical in both shells.
Ubuntu within WSL is a separate Linux environment. In it, install and configure Git using Part 4 methods. Rather than editing the same repository alternately between Windows and WSL, it is easier to keep the working folder on the file system of the environment you will use it in to reduce permissions and performance issues.
Authentication and line breaks are managed on a storage basis.
Git Credential Manager, included with Git for Windows, helps with HTTPS authentication. Avoid putting personal access tokens in remote URLs or storing them in plain text files. Check which login methods your company’s server allows, and decide between HTTPS and SSH.
git config --show-origin --get-all credential.helper
git config --show-origin --get core.autocrlf
core.autocrlf is involved in line break conversion. If the project has already set a policy as .gitattributes, check that rule first. Windows commonly uses CRLF and Linux commonly uses LF, so if you move files without a policy, it may appear that all lines have changed even though the content remains the same. In Part 13, rules for each file type are written.
Once git --version and author information are confirmed, move to Part 5. For a detailed explanation of installation options, refer to Git for Windows document , and for the winget command, refer to Microsoft’s winget install guide.
Previous · [Git and GitOps 01] Repositories, Commits and the Role of GitOps · Next · [Git and GitOps 03] Install Git and Prepare an Account on Rocky Linux 9 · Series list and example files



