Created
May 28, 2026 03:20
-
-
Save junetech/65769572192ef233f38803384039d0c4 to your computer and use it in GitHub Desktop.
Windows 11에서 Git symlink 활성화
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Requires -Version 7 | |
| # enable-git-symlinks.ps1 | |
| # Windows 11 Git symlink 환경 설정 마법사 | |
| Set-StrictMode -Version Latest | |
| $ErrorActionPreference = "Stop" | |
| function Write-Status { | |
| param([string]$Status, [string]$Message, [string]$Color) | |
| Write-Host "[$Status] " -ForegroundColor $Color -NoNewline | |
| Write-Host $Message | |
| } | |
| function Write-OK { param([string]$Message) Write-Status "OK" $Message "Green" } | |
| function Write-Warn { param([string]$Message) Write-Status "WARN" $Message "Yellow" } | |
| function Write-Fail { param([string]$Message) Write-Status "FAIL" $Message "Red" } | |
| function Write-Info { param([string]$Message) Write-Status "INFO" $Message "Cyan" } | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Step 1: Git 설치 확인 | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| function Test-GitInstallation { | |
| Write-Host "`n[Step 1] Git 설치 확인" -ForegroundColor White | |
| Write-Host ("=" * 50) | |
| $gitPath = Get-Command git -ErrorAction SilentlyContinue | |
| if ($gitPath) { | |
| $version = git --version | |
| Write-OK "Git 설치됨: $version" | |
| return $true | |
| } else { | |
| Write-Fail "Git이 설치되어 있지 않습니다." | |
| Write-Host "" | |
| Write-Host "설치 방법:" -ForegroundColor Yellow | |
| Write-Host " 1. https://git-scm.com/download/win 에서 다운로드" | |
| Write-Host " 2. 또는 winget 사용:" | |
| Write-Host " winget install Git.Git" -ForegroundColor Cyan | |
| Write-Host "" | |
| Write-Host "설치 후 이 스크립트를 다시 실행하세요." | |
| return $false | |
| } | |
| } | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Step 2: Git 사용자 정보 설정 | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| function Set-GitUserInfo { | |
| Write-Host "`n[Step 2] Git 사용자 정보 설정" -ForegroundColor White | |
| Write-Host ("=" * 50) | |
| $currentName = git config --global user.name 2>$null | |
| $currentEmail = git config --global user.email 2>$null | |
| if ($currentName) { | |
| Write-OK "user.name: $currentName" | |
| } else { | |
| Write-Warn "user.name이 설정되어 있지 않습니다." | |
| $newName = Read-Host "Git 사용자 이름 (예: Hong Gildong)" | |
| if ($newName) { | |
| git config --global user.name $newName | |
| Write-OK "user.name 설정됨: $newName" | |
| } else { | |
| Write-Warn "user.name 설정 건너뜀" | |
| } | |
| } | |
| if ($currentEmail) { | |
| Write-OK "user.email: $currentEmail" | |
| } else { | |
| Write-Warn "user.email이 설정되어 있지 않습니다." | |
| $newEmail = Read-Host "Git 이메일 (예: gildong@example.com)" | |
| if ($newEmail) { | |
| git config --global user.email $newEmail | |
| Write-OK "user.email 설정됨: $newEmail" | |
| } else { | |
| Write-Warn "user.email 설정 건너뜀" | |
| } | |
| } | |
| } | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Step 3: Windows 개발자 모드 확인 | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| function Test-DeveloperMode { | |
| Write-Host "`n[Step 3] Windows 11 개발자 모드 확인" -ForegroundColor White | |
| Write-Host ("=" * 50) | |
| $regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" | |
| $devMode = $null | |
| try { | |
| $devMode = Get-ItemProperty -Path $regPath -Name "AllowDevelopmentWithoutDevLicense" -ErrorAction SilentlyContinue | |
| } catch { | |
| } | |
| if ($devMode -and $devMode.AllowDevelopmentWithoutDevLicense -eq 1) { | |
| Write-OK "개발자 모드가 활성화되어 있습니다." | |
| return $true | |
| } else { | |
| Write-Warn "개발자 모드가 비활성화되어 있습니다." | |
| Write-Host "" | |
| Write-Host "개발자 모드 활성화 방법:" -ForegroundColor Yellow | |
| Write-Host " 1. Windows 설정 (Win+I) 열기" | |
| Write-Host " 2. 시스템 > 개발자 옵션" | |
| Write-Host " 3. '개발자 모드' 토글 켜기" | |
| Write-Host " 4. 컴퓨터 재시작 권장" | |
| Write-Host "" | |
| Write-Host "개발자 모드를 켜야 symlink를 만들 수 있습니다." | |
| return $false | |
| } | |
| } | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Step 4: Git core.symlinks 설정 | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| function Set-GitSymlinks { | |
| Write-Host "`n[Step 4] Git core.symlinks 설정" -ForegroundColor White | |
| Write-Host ("=" * 50) | |
| $currentValue = git config --global core.symlinks 2>$null | |
| if ($currentValue -eq "true") { | |
| Write-OK "core.symlinks = true (글로벌)" | |
| } else { | |
| if ($currentValue) { | |
| Write-Warn "core.symlinks = $currentValue (글로벌)" | |
| } else { | |
| Write-Warn "core.symlinks가 설정되어 있지 않습니다." | |
| } | |
| $confirm = Read-Host "core.symlinks = true로 설정하시겠습니까? (Y/n)" | |
| if ($confirm -eq "" -or $confirm -match "^[Yy]") { | |
| git config --global core.symlinks true | |
| Write-OK "core.symlinks = true 설정됨" | |
| } else { | |
| Write-Warn "설정 건너뜀" | |
| } | |
| } | |
| } | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Main | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| Write-Host "" | |
| Write-Host "========================================================" -ForegroundColor Cyan | |
| Write-Host " Windows 11 Git Symlink 환경설정 마법사" -ForegroundColor Cyan | |
| Write-Host "========================================================" -ForegroundColor Cyan | |
| $gitOK = Test-GitInstallation | |
| if (-not $gitOK) { exit 1 } | |
| Set-GitUserInfo | |
| $devModeOK = Test-DeveloperMode | |
| Set-GitSymlinks | |
| Write-Host "`n" | |
| Write-Host "========================================================" -ForegroundColor Green | |
| Write-Host " 설정 완료!" -ForegroundColor Green | |
| Write-Host "========================================================" -ForegroundColor Green | |
| if (-not $devModeOK) { | |
| Write-Host "" | |
| Write-Warn "개발자 모드가 아직 비활성화되어 있습니다." | |
| Write-Host "개발자 모드를 켠 후 컴퓨터를 재시작하세요." | |
| } | |
| Write-Host "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment