From e7ce41cbbcafb2e58abe80db849fb36412961782 Mon Sep 17 00:00:00 2001 From: Bjarke Sporring Date: Wed, 14 Jan 2026 16:29:09 +0100 Subject: [PATCH] Update oneshot installation to clone repository locally - Modified install.ps1 to clone git-workshop repository to ~/git-workshop - Added option to remove existing directory before cloning - Updated documentation to reflect the new behavior - Now provides complete setup: install tools + clone repo in one command - Similar to Scoop's get.scoop.sh installation pattern --- INSTALLATION.md | 7 ++++++- README.md | 7 ++++++- install.ps1 | 42 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/INSTALLATION.md b/INSTALLATION.md index 9ac3c98..b722b1a 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -4,12 +4,17 @@ This guide will help you install everything needed for the Git Workshop on Windo ## Quick Start (Automated Installation) -**Easiest option:** Run our oneshot installation script that downloads everything and installs all required tools automatically. +**Easiest option:** Run our oneshot installation script that installs all prerequisites and clones the repository automatically. ```powershell irm https://git.frod.dk/floppydiscen/git-workshop/raw/branch/main/install.ps1 | iex ``` +This will: +- Install PowerShell 7, Git 2.23+, and Visual Studio Code +- Clone the git-workshop repository to `~/git-workshop` +- Leave you ready to start the workshop immediately + **Alternative:** If you've already cloned the repository, you can run the local installation script: 1. Open **PowerShell** or **Windows Terminal** diff --git a/README.md b/README.md index ff20e83..fe98043 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,17 @@ Then run scripts using: **Quick Automated Installation (Windows 11):** **Option 1: Oneshot Installation (Recommended)** -Download and run everything in one command: +Download, install prerequisites, and clone the repository in one command: ```powershell irm https://git.frod.dk/floppydiscen/git-workshop/raw/branch/main/install.ps1 | iex ``` +This will: +- Install PowerShell 7, Git 2.23+, and Visual Studio Code +- Clone the git-workshop repository to `~/git-workshop` +- Leave you ready to start the first module + **Option 2: Local Installation** Clone the repository first, then run: diff --git a/install.ps1 b/install.ps1 index 0f83cdf..41f1ce7 100644 --- a/install.ps1 +++ b/install.ps1 @@ -197,6 +197,38 @@ catch { Write-Host " You can manually delete: $tempDir" -ForegroundColor Yellow } +# Clone the repository locally +Write-Step "Cloning Git Workshop Repository" + +$cloneDir = Join-Path $HOME "git-workshop" + +try { + if (Test-Path $cloneDir) { + Write-Warning "Directory already exists: $cloneDir" + $response = Read-Host " Do you want to remove it and clone fresh? (y/n)" + if ($response.Trim().ToLower() -eq 'y' -or $response.Trim().ToLower() -eq 'yes') { + Remove-Item -Path $cloneDir -Recurse -Force + Write-Host " Removed existing directory" -ForegroundColor Gray + } + else { + Write-Host " Skipping clone - using existing directory" -ForegroundColor Gray + } + } + + if (-not (Test-Path $cloneDir)) { + Write-Host " Cloning to: $cloneDir" -ForegroundColor Gray + git clone "https://git.frod.dk/floppydiscen/git-workshop.git" $cloneDir + Write-Success "Repository cloned successfully!" + } +} +catch { + Write-Error "Failed to clone repository: $_" + Write-Host "" + Write-Host "You can clone manually:" -ForegroundColor Yellow + Write-Host " git clone https://git.frod.dk/floppydiscen/git-workshop.git ~/git-workshop" -ForegroundColor White + exit 1 +} + # Final instructions Write-Step "Installation Complete" @@ -204,11 +236,17 @@ Write-Host "" Write-Success "Git Workshop installation is complete!" Write-Host "" +Write-Host "Repository cloned to: $cloneDir" -ForegroundColor Green +Write-Host "" + Write-Host "Next steps:" -ForegroundColor Cyan -Write-Host " 1. Clone or download the Git Workshop repository" -ForegroundColor White -Write-Host " 2. Configure Git if you haven't already:" -ForegroundColor White +Write-Host " 1. Configure Git if you haven't already:" -ForegroundColor White Write-Host " git config --global user.name `"Your Name`"" -ForegroundColor Gray Write-Host " git config --global user.email `"your.email@example.com`"" -ForegroundColor Gray +Write-Host "" +Write-Host " 2. Navigate to the workshop:" -ForegroundColor White +Write-Host " cd $cloneDir" -ForegroundColor Gray +Write-Host "" Write-Host " 3. Start with the first module:" -ForegroundColor White Write-Host " cd 01-essentials\01-basics" -ForegroundColor Gray Write-Host " .\setup.ps1" -ForegroundColor Gray