MENU
Language

How to install Git for Windows and how to use it (initial setup + command operation)

This section explains how to install Git and how to use it (initial setup + command operation) in an easy-to-understand manner for beginners. We can also provide a guide with a screen, so please let us know if you need it.

目次

1. How to install Git (Windows)

Install from the official website

Download Git from the official website.

OSway
Windows.exeand follow the instructions of the installer.This time, I will explain it in this step.
macOSbrew install git(Homebrew recommended) or official dmg version
Linuxsudo apt install git(Ubuntu), etc., run it in a package manager.

*X Server VPS is explained separately here↓

Download the installer for your environment.

How to check if your Windows is 64-bit or 32-bit

  1. Open Settings→ System→ About from the Start menu
  2. If the System Type says 64-bit operating system, it is 64-bit.

Points to consider when choosing

choiceTarget Audience and Application
32-bit Git for Windows SetupIf you have 32-bit Windows, please select here.
64-bit Git for Windows SetupIf you have a 64-bit Windows, please choose here.
In general, this is often the case.
This time, I will explain it in this step.
Portable(thumbdrive edition)For Portable users
Using winget toolFor advanced players

How to run the installer

  1. Click on “64-bit Git for Windows Setup”
  2. Run the downloaded .exe file
  3. Proceed with “Next” as instructed by the installer (the basics are OK as they are).
  4. After the installation is complete, check in the command prompt:
bashcopyeditgit --version
git --version

After installation, an example I checked at the command prompt or terminal:

git version 2.48.1.windows.1

git version x.xx.x If you see a version like →, you’re successful.

Initial Git setup (only the first time after installation)

Set the name and email address you want to use for commits in Git:

git config --global user.name "あなたの名前"
git config --global user.email "あなたのメールアドレス"

To check your settings:

git config --list

Things to keep in mind if you already have a GitHub account

In order for your commits to be correctly recognized as your account on GitHub, you need to use the
Gituser.email must match one of the email addresses you have on GitHub.
Gituser.name can be different from your GitHub username, but it’s the “display name” that is recorded in your Git commits.

user.name is recorded in the commit history, but it is user.email the one that is matched to the GitHub account.

Basic usage of Git (local repository)

🔹 Step 1: Initialize the repository

Initializing the repository (git init) is done on a project-by-project basis.
Run the following command in PowerShell:
cd プロジェクトのフォルダ
git init

Example in action:

mkdir ~/projects/personal/my-website
cd ~/projects/personal/my-website
git init

.git The folder is created and Git management begins.

Step 2: Add and commit files

Add any file to the project folder and commit it.
git add .
git commit -m "初回コミット"

Command Explanation

git add .

Meaning:
Stage (Prepare) all modified files under the current folder (current directory) command.

  • 「. (dot)” means “all of this directory and below”.
  • All newly created, modified, or deleted files are eligible.

Example:git add . Yes

git add ファイルA
git add フォルダB/ファイルB
...

It is the same as doing it all at once.

add is “Preparing to include file changes in the commit”.
It is not saved in the history at this point yet.

git commit -m "初回コミット"

Meaning:
This command saves staged changes as a single history (commit).

  • -m is an abbreviation for “message”.
  • "初回コミット" Explanatory comments (what did you do) that will remain in the history

By this:

  • When, by whom, and what changes are recorded
  • You can return to the past later and compare them

troubleshooting

situationWhat to do
Adding a file does git commit not reflect if it is onlyAlways need first git add
If you forgot to write a message-m "修正後のコメント" or later git commit --amend -m "修正後のコメント"
I want to check the staginggit status Available at
I want to see commentsgit log

Step 3: Connect with a remote repository (e.g., GitHub) (optional)

git remote add origin https://github.com/ユーザー名/リポジトリ名.git
git push -u origin main

* GitHub linkage will be explained separately.

Step 4: List of frequently used commands

commandexplanation
git statusStatus check
git add ファイル名Staging files
git commit -m "コメント"Record changes
git logChecking History
git branchBranch confirmation and creation
git checkout -b ブランチ名Branch creation + switching
git pushReflect remotely
git pullGet the latest from remote

Official documentation

Let's share this post !

Author of this article

AIアーティスト | エンジニア | ライター | 最新のAI技術やトレンド、注目のモデル解説、そして実践に役立つ豊富なリソースまで、幅広い内容を記事にしています。フォローしてねヾ(^^)ノ

Comments

To comment

目次