Git เป็น Version Control System มาตรฐานอุตสาหกรรม สำคัญสำหรับนักพัฒนาทุกคน บน Windows ต้องติดตั้งเอง บทความนี้แนะนำขั้นตอนติดตั้ง Git for Windows แบบละเอียด พร้อมตัวเลือกที่แนะนำ
ดาวน์โหลดและติดตั้ง Git for Windows
- ไปที่ git-scm.com/download/win
- ดาวน์โหลด Installer: 64-bit Git for Windows Setup (สำหรับ Windows 10/11 64-bit ทุกเครื่อง)
- รัน Installer (.exe)
ตัวเลือกติดตั้งที่แนะนำ (Recommended Options)

ผ่าน Wizard ตามลำดับ - ตัวเลือกที่ควรเลือก:
| ขั้นตอน | ตัวเลือกที่แนะนำ | เหตุผล |
|---|---|---|
| Select Components | Default (ติ๊ก Git Bash, Git GUI, Shell Integration) | ครบถ้วนสำหรับใช้งานทั่วไป |
| Default Editor | Visual Studio Code (หรือ Notepad++ / Vim) | VS Code เป็นมาตรฐาน ปัจจุบัน Installer ตรวจจับ VS Code อัตโนมัติ |
| Initial Branch Name | Let Git Decide (Default: main) | ใช้ Branch name ใหม่มาตรฐาน (main แทน master) |
| PATH Environment | Git from the command line and also from 3rd-party software | ใช้ Git ได้จาก CMD, PowerShell, และ IDE ทุกตัว |
| SSH Executable | Use bundled OpenSSH | ใช้ OpenSSH มาพร้อม Git ไม่ต้องพึ่ง Windows/OpenSSH แยกต่างหาก |
| HTTPS Transport | Use the OpenSSL library (Default) | มาตรฐาน รองรับ HTTPS ทุกกรณี |
| Line Endings | Checkout Windows-style, commit Unix-style (Default) | จัดการ Line Endings (CRLF/LF) อัตโนมัติ ป้องกันปัญหา Cross-platform |
| Terminal Emulator | Use MinTTY (Default) | Terminal สำหรับ Git Bash สวยงาม รองรับ Unicode ดี |
| Git Pull Behavior | Default (Fast-forward or merge) | พฤติกรรมมาตรฐาน |
| Credential Helper | Git Credential Manager Core (Default - ไม่ใช่ None) | จัดการ Credential (GitHub, Azure DevOps, Bitbucket) อัตโนมัติ และปลอดภัย |
| Extra Options | ติ๊ก: Enable file system caching, Enable symbolic links | เพิ่มประสิทธิภาพและรองรับ Symlinks |
คลิก Install > รอเสร็จ > Finish
ยืนยันการติดตั้ง

- เปิด Git Bash (จาก Start Menu หรือติ๊ก Launch Git Bash ตอน Finish)
- พิมพ์:
git --version - ควรเห็น:
git version 2.x.x.windows.y= ติดตั้งสำเร็จ!
การตั้งค่าเริ่มต้นหลังติดตั้ง (First-time Config)
# ตั้งค่าชื่อและอีเมล (ใช้สำหรับ Commits)
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
# ตั้งค่า Default Branch (ถ้าไม่ได้เลือก Let Git Decide)
git config --global init.defaultBranch main
# ตรวจสอบการตั้งค่า
git config --global --list
ขั้นตอนต่อไป
- GitHub Desktop / GitHub CLI (gh) - GUI/CLI สำหรับ GitHub
- SSH Key Generation:
ssh-keygen -t ed25519 -C "your.email@example.com"เพื่อ Clone/Push ผ่าน SSH - Git Aliases: สร้าง Shortcut คำสั่งยาว (เช่น
git config --global alias.st status)
สรุป
ติดตั้ง Git บน Windows: ดาวน์โหลดจาก git-scm.com -> รัน Installer -> เลือกตัวเลือกแนะนำ (VS Code Editor, Let Git Decide, Git from CMD+3rd party, OpenSSH, GCM Core) -> Verify ด้วย git --version -> ตั้งค่า user.name/user.email เริ่มใช้งานได้เลย!