From 12dd59736010ceb5aa5447f6b75d40259c623265 Mon Sep 17 00:00:00 2001 From: PTah Date: Fri, 19 Jun 2026 23:32:31 +1000 Subject: [PATCH] =?UTF-8?q?install:=20SSH=20clone=20first;=20=D1=83=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D1=82=D1=8C=20irm=20=D0=B4=D0=BB=D1=8F=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=D0=B2=D0=B0=D1=82=D0=BD=D0=BE=D0=B3=D0=BE=20repo.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 15 +++++++++++++-- init-cursor.ps1 | 8 +++++--- install.ps1 | 21 +++++++++++++++------ 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b6d467f..15b69a4 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,21 @@ ## Новый Windows-ПК -В каталоге **вашего проекта** (один раз, Gitea спросит логин/пароль по HTTPS): +Репозиторий **приватный** — `irm .../raw/.../install.ps1` без авторизации даст **404**. + +### Вариант A: SSH уже работает (этот ПК) ```powershell -irm https://git.kalinamall.ru/PapaTramp/Rules/raw/branch/main/install.ps1 | iex +cd C:\Users\papat\Projects\your-repo +git clone --depth 1 ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git $HOME\CursorRules +& $HOME\CursorRules\install.ps1 +``` + +### Вариант B: SSH ещё нет (HTTPS, логин один раз) + +```powershell +git clone --depth 1 https://git.kalinamall.ru/PapaTramp/Rules.git $HOME\CursorRules +& $HOME\CursorRules\install.ps1 ``` Дальше в любом проекте: diff --git a/init-cursor.ps1 b/init-cursor.ps1 index d1b9f7d..a235b77 100644 --- a/init-cursor.ps1 +++ b/init-cursor.ps1 @@ -8,8 +8,9 @@ - если машина не настроена: SSH, Gitea keys, clone Rules в $HOME\CursorRules - затем копирует rules в текущий репозиторий и настраивает remotes - Первый запуск на голом ПК (из каталога проекта): - irm https://git.kalinamall.ru/PapaTramp/Rules/raw/branch/main/install.ps1 | iex + Первый запуск (приватный repo — через git clone, см. README): + git clone --depth 1 ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git $HOME\CursorRules + & $HOME\CursorRules\install.ps1 .EXAMPLE cd C:\Users\papat\Projects\MyRepo @@ -47,7 +48,8 @@ function Initialize-CursorRulesEnvironment { if (-not $bootstrapRoot) { Write-Host 'Error: CursorRules not found. Run install.ps1 from Gitea first:' -ForegroundColor Red - Write-Host ' irm https://git.kalinamall.ru/PapaTramp/Rules/raw/branch/main/install.ps1 | iex' -ForegroundColor Yellow + Write-Host ' git clone --depth 1 ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git $HOME\CursorRules' -ForegroundColor Yellow + Write-Host ' & $HOME\CursorRules\install.ps1' -ForegroundColor Yellow return $false } diff --git a/install.ps1 b/install.ps1 index 590f061..47bf2ad 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,11 +1,15 @@ #Requires -Version 5.1 <# .SYNOPSIS - Первая загрузка с Gitea: clone Rules и запуск init-cursor в текущем проекте. + Первая загрузка Rules и запуск init-cursor в текущем проекте. + +.DESCRIPTION + Репозиторий приватный — irm .../raw/.../install.ps1 без логина вернёт 404. + Запускайте этот файл после clone или однострочник из README. .EXAMPLE - cd C:\path\to\your-repo - irm https://git.kalinamall.ru/PapaTramp/Rules/raw/branch/main/install.ps1 | iex + git clone --depth 1 ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git $HOME\CursorRules + & $HOME\CursorRules\install.ps1 #> [CmdletBinding()] param( @@ -21,13 +25,18 @@ $httpsUrl = 'https://git.kalinamall.ru/PapaTramp/Rules.git' $sshUrl = 'ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git' if (-not (Test-Path (Join-Path $rulesDest '.git'))) { - Write-Host '[*] Cloning Rules from Gitea (HTTPS, login once if asked)...' -ForegroundColor Cyan if (Test-Path -LiteralPath $rulesDest) { throw "Path exists and is not a git repo: $rulesDest" } - git clone --depth 1 $httpsUrl $rulesDest + + Write-Host '[*] Cloning Rules via SSH...' -ForegroundColor Cyan + git clone --depth 1 $sshUrl $rulesDest 2>&1 | Out-Null if ($LASTEXITCODE -ne 0) { - throw 'git clone failed' + Write-Host '[!] SSH clone failed - trying HTTPS (enter Gitea login once)...' -ForegroundColor Yellow + git clone --depth 1 $httpsUrl $rulesDest + if ($LASTEXITCODE -ne 0) { + throw 'git clone failed' + } } Write-Host "[+] Cloned to $rulesDest" -ForegroundColor Green }