Files
shop10/push-to-gitea.ps1
T

37 lines
962 B
PowerShell

# Push в https://git.evilfox.cc/test/shop3.git
# При запросе введите логин и пароль (или токен Gitea) от git.evilfox.cc
$ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot
$git = Get-Command git -ErrorAction SilentlyContinue
if (-not $git) {
$git = "C:\Program Files\Git\bin\git.exe"
if (-not (Test-Path $git)) {
Write-Error "Git не найден. Установите: winget install Git.Git"
}
} else {
$git = $git.Source
}
$remote = "https://git.evilfox.cc/test/shop3.git"
if (-not (Test-Path .git)) {
& $git init -b main
}
& $git add -A
$status = & $git status --porcelain
if ($status) {
& $git commit -m "Интернет-магазин: Go, PostgreSQL 17 SSL, Caddy, Docker Compose"
}
$remotes = & $git remote 2>$null
if ($remotes -contains "origin") {
& $git remote set-url origin $remote
} else {
& $git remote add origin $remote
}
& $git push -u origin main