File size: 746 Bytes
0a0f923
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$maxRetries = 50
$retryDelayMinutes = 10
$attempt = 1

while ($attempt -le $maxRetries) {
    Write-Host ""
    Write-Host "Attempt ${attempt}: Running 'git lfs push --all origin main'..."

    git lfs push --all origin main

    if ($LASTEXITCODE -eq 0) {
        Write-Host ""
        Write-Host "Push successful on attempt ${attempt}."
        break
    } else {
        Write-Host ""
        Write-Host "Push failed on attempt ${attempt}. Retrying in ${retryDelayMinutes} minutes..."
        Start-Sleep -Seconds ($retryDelayMinutes * 60)
        $attempt++
    }
}

if ($attempt -gt $maxRetries) {
    Write-Host ""
    Write-Host "Push failed after ${maxRetries} attempts. Please check your connection or repo."
}