| $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." | |
| } | |