# =========================================== # Git LFS Setup for Windows (ThinkPad P16) # CAD Versioning with Gitea on dalidou # =========================================== Write-Host "=== Git LFS Setup for CAD Versioning ===" -ForegroundColor Cyan Write-Host "" # ----------------------------------------- # Step 1: Check Git installation # ----------------------------------------- Write-Host "[1/5] Checking Git installation..." -ForegroundColor Yellow try { $gitVersion = git --version Write-Host "Git installed: $gitVersion" -ForegroundColor Green } catch { Write-Host "ERROR: Git is not installed!" -ForegroundColor Red Write-Host "Install Git from: https://git-scm.com/download/win" Write-Host "Or run: winget install Git.Git" exit 1 } # ----------------------------------------- # Step 2: Install Git LFS # ----------------------------------------- Write-Host "" Write-Host "[2/5] Checking/Installing Git LFS..." -ForegroundColor Yellow try { $lfsVersion = git lfs version Write-Host "Git LFS installed: $lfsVersion" -ForegroundColor Green } catch { Write-Host "Git LFS not found. Installing..." -ForegroundColor Yellow # Try winget first $wingetInstalled = Get-Command winget -ErrorAction SilentlyContinue if ($wingetInstalled) { Write-Host "Installing via winget..." winget install GitHub.GitLFS --accept-package-agreements --accept-source-agreements } else { Write-Host "ERROR: Please install Git LFS manually from https://git-lfs.github.com/" exit 1 } } # ----------------------------------------- # Step 3: Initialize Git LFS globally # ----------------------------------------- Write-Host "" Write-Host "[3/5] Initializing Git LFS..." -ForegroundColor Yellow git lfs install Write-Host "Git LFS initialized globally" -ForegroundColor Green # ----------------------------------------- # Step 4: Configure Git for large files # ----------------------------------------- Write-Host "" Write-Host "[4/5] Configuring Git for large file uploads..." -ForegroundColor Yellow # Increase HTTP buffer for large CAD files git config --global http.postBuffer 524288000 # Configure credentials for Gitea git config --global credential.helper manager Write-Host "HTTP buffer set to 500MB" -ForegroundColor Green Write-Host "Credential helper configured" -ForegroundColor Green # ----------------------------------------- # Step 5: Display connection info # ----------------------------------------- Write-Host "" Write-Host "[5/5] Setup Complete!" -ForegroundColor Green Write-Host "" Write-Host "=== Gitea Server Info ===" -ForegroundColor Cyan Write-Host "URL: http://git.dalidou.home" -ForegroundColor White Write-Host "Alt URL: http://192.168.86.50:3000" -ForegroundColor White Write-Host "SSH: ssh://git@192.168.86.50:2222" -ForegroundColor White Write-Host "" Write-Host "=== Next Steps ===" -ForegroundColor Cyan Write-Host "1. Create a new repository in Gitea web UI" Write-Host "2. Clone it:" Write-Host " git clone http://git.dalidou.home/antoine/cad-projects.git" Write-Host "" Write-Host "3. Copy .gitattributes and .gitignore to the repo:" Write-Host " Copy-Item '.\.gitattributes' 'cad-projects\'" Write-Host " Copy-Item '.\.gitignore' 'cad-projects\'" Write-Host "" Write-Host "4. Commit and push:" Write-Host " cd cad-projects" Write-Host " git add .gitattributes .gitignore" Write-Host " git commit -m 'Add LFS tracking for CAD files'" Write-Host " git push" Write-Host "" Write-Host "=== Daily Workflow Commands ===" -ForegroundColor Cyan Write-Host "Lock file: git lfs lock 'path/to/file.prt'" Write-Host "View locks: git lfs locks" Write-Host "Unlock: git lfs unlock 'path/to/file.prt'" Write-Host "LFS status: git lfs status" Write-Host ""