install: SSH clone first; убрать irm для приватного repo.

This commit is contained in:
2026-06-19 23:32:31 +10:00
parent e1078dc6ed
commit 12dd597360
3 changed files with 33 additions and 11 deletions
+13 -2
View File
@@ -13,10 +13,21 @@
## Новый Windows-ПК ## Новый Windows-ПК
В каталоге **вашего проекта** (один раз, Gitea спросит логин/пароль по HTTPS): Репозиторий **приватный**`irm .../raw/.../install.ps1` без авторизации даст **404**.
### Вариант A: SSH уже работает (этот ПК)
```powershell ```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
``` ```
Дальше в любом проекте: Дальше в любом проекте:
+5 -3
View File
@@ -8,8 +8,9 @@
- если машина не настроена: SSH, Gitea keys, clone Rules в $HOME\CursorRules - если машина не настроена: SSH, Gitea keys, clone Rules в $HOME\CursorRules
- затем копирует rules в текущий репозиторий и настраивает remotes - затем копирует rules в текущий репозиторий и настраивает remotes
Первый запуск на голом ПК (из каталога проекта): Первый запуск (приватный repo — через git clone, см. README):
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
.EXAMPLE .EXAMPLE
cd C:\Users\papat\Projects\MyRepo cd C:\Users\papat\Projects\MyRepo
@@ -47,7 +48,8 @@ function Initialize-CursorRulesEnvironment {
if (-not $bootstrapRoot) { if (-not $bootstrapRoot) {
Write-Host 'Error: CursorRules not found. Run install.ps1 from Gitea first:' -ForegroundColor Red 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 return $false
} }
+13 -4
View File
@@ -1,11 +1,15 @@
#Requires -Version 5.1 #Requires -Version 5.1
<# <#
.SYNOPSIS .SYNOPSIS
Первая загрузка с Gitea: clone Rules и запуск init-cursor в текущем проекте. Первая загрузка Rules и запуск init-cursor в текущем проекте.
.DESCRIPTION
Репозиторий приватный — irm .../raw/.../install.ps1 без логина вернёт 404.
Запускайте этот файл после clone или однострочник из README.
.EXAMPLE .EXAMPLE
cd C:\path\to\your-repo git clone --depth 1 ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git $HOME\CursorRules
irm https://git.kalinamall.ru/PapaTramp/Rules/raw/branch/main/install.ps1 | iex & $HOME\CursorRules\install.ps1
#> #>
[CmdletBinding()] [CmdletBinding()]
param( param(
@@ -21,14 +25,19 @@ $httpsUrl = 'https://git.kalinamall.ru/PapaTramp/Rules.git'
$sshUrl = 'ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git' $sshUrl = 'ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git'
if (-not (Test-Path (Join-Path $rulesDest '.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) { if (Test-Path -LiteralPath $rulesDest) {
throw "Path exists and is not a git repo: $rulesDest" throw "Path exists and is not a git repo: $rulesDest"
} }
Write-Host '[*] Cloning Rules via SSH...' -ForegroundColor Cyan
git clone --depth 1 $sshUrl $rulesDest 2>&1 | Out-Null
if ($LASTEXITCODE -ne 0) {
Write-Host '[!] SSH clone failed - trying HTTPS (enter Gitea login once)...' -ForegroundColor Yellow
git clone --depth 1 $httpsUrl $rulesDest git clone --depth 1 $httpsUrl $rulesDest
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
throw 'git clone failed' throw 'git clone failed'
} }
}
Write-Host "[+] Cloned to $rulesDest" -ForegroundColor Green Write-Host "[+] Cloned to $rulesDest" -ForegroundColor Green
} }