# Try different methods to create Git repositories $GIT_SERVER = "git.alicorns.co.jp" $GIT_USER = "aitest" $GIT_PASSWORD = "Aitest123456" Write-Host "=== Attempting different methods to create Git repositories ===" Write-Host "" # Method 1: Try GitLab API (if the server is GitLab) Write-Host "Method 1: Check if GitLab server" try { $response = Invoke-WebRequest -Uri "https://$GIT_SERVER/api/v4/version" -UseBasicParsing -TimeoutSec 5 -ErrorAction Stop if ($response.StatusCode -eq 200) { Write-Host "[FOUND] This is a GitLab server" Write-Host "GitLab detected" } } catch { Write-Host "Not GitLab or not accessible" } Write-Host "" # Method 2: Try direct HTTP creation Write-Host "Method 2: Try direct HTTP creation" foreach ($repo in @("office-file-handler", "dingtalk-media-sender")) { Write-Host "Creating $repo..." $authHeader = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$GIT_USER`:$GIT_PASSWORD")) try { $headers = @{ "Authorization" = "Basic $authHeader" "Content-Type" = "application/json" } # Create JSON body $body = @{ name = $repo visibility = "private" } $bodyJson = $body | ConvertTo-Json # Try GitLab style try { $response = Invoke-WebRequest -Uri "https://$GIT_SERVER/api/v4/projects" -Headers $headers -Method Post -Body $bodyJson -UseBasicParsing -ErrorAction Stop if ($response.StatusCode -in @(201, 200)) { Write-Host "[SUCCESS] $repo created via API" } } catch { Write-Host "[FAILED] API creation failed" } } catch { Write-Host "[ERROR] $repo creation failed" } } Write-Host "" Write-Host "=== Manual Creation Required ===" Write-Host "If automatic creation fails, you need to:" Write-Host "1. Login to https://$GIT_SERVER/ as $GIT_USER" Write-Host "2. Create repositories: office-file-handler, dingtalk-media-sender" Write-Host "3. Then run push commands"