-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_github.ps1
More file actions
110 lines (99 loc) · 4.11 KB
/
setup_github.ps1
File metadata and controls
110 lines (99 loc) · 4.11 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# GitHub Integration Setup Script for Windows PowerShell
# Run this script: .\setup_github.ps1
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host "GitHub Integration Setup" -ForegroundColor Cyan
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host ""
# Check if Git is installed
try {
$gitVersion = git --version
Write-Host "✓ Git is installed: $gitVersion" -ForegroundColor Green
} catch {
Write-Host "✗ Git is not installed" -ForegroundColor Red
Write-Host ""
Write-Host "Please install Git first:" -ForegroundColor Yellow
Write-Host " - Download from: https://git-scm.com/download/win" -ForegroundColor Yellow
Write-Host " - Or use: winget install Git.Git" -ForegroundColor Yellow
exit 1
}
Write-Host ""
# Get GitHub token
$token = Read-Host "Enter your GitHub Personal Access Token (or press Enter to skip)"
if ($token) {
Write-Host "✓ Token received" -ForegroundColor Green
# Save token to file (will be gitignored)
$token | Out-File -FilePath ".github_token" -NoNewline -Encoding utf8
Write-Host "✓ Token saved to .github_token" -ForegroundColor Green
} else {
Write-Host "ℹ No token provided - you'll need to authenticate manually" -ForegroundColor Yellow
}
Write-Host ""
# Initialize Git repository
if (Test-Path ".git") {
Write-Host "✓ Git repository already initialized" -ForegroundColor Green
} else {
git init
if ($LASTEXITCODE -eq 0) {
Write-Host "✓ Git repository initialized" -ForegroundColor Green
} else {
Write-Host "✗ Failed to initialize Git repository" -ForegroundColor Red
exit 1
}
}
# Configure Git user
$currentUser = git config user.name
if ($currentUser) {
Write-Host "✓ Git user.name already set: $currentUser" -ForegroundColor Green
} else {
git config user.name "surajdeval"
Write-Host "✓ Git user.name set to: surajdeval" -ForegroundColor Green
}
$currentEmail = git config user.email
if ($currentEmail) {
Write-Host "✓ Git user.email already set: $currentEmail" -ForegroundColor Green
} else {
$email = Read-Host "Enter your GitHub email (or press Enter to skip)"
if ($email) {
git config user.email $email
Write-Host "✓ Git user.email set to: $email" -ForegroundColor Green
}
}
# Set remote repository
$remoteUrl = git remote get-url origin 2>$null
if ($remoteUrl) {
Write-Host "✓ Remote 'origin' already exists: $remoteUrl" -ForegroundColor Green
if ($token) {
$newUrl = "https://$token@github.com/surajdeval/PRO_SOW_GPT.git"
git remote set-url origin $newUrl
Write-Host "✓ Remote URL updated with authentication token" -ForegroundColor Green
}
} else {
if ($token) {
$remoteUrl = "https://$token@github.com/surajdeval/PRO_SOW_GPT.git"
} else {
$remoteUrl = "https://github.com/surajdeval/PRO_SOW_GPT.git"
}
git remote add origin $remoteUrl
Write-Host "✓ Remote 'origin' added" -ForegroundColor Green
}
Write-Host ""
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host "Setup Complete!" -ForegroundColor Cyan
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. Create the repository on GitHub:" -ForegroundColor Yellow
Write-Host " https://github.com/new" -ForegroundColor White
Write-Host " Repository name: PRO_SOW_GPT" -ForegroundColor White
Write-Host ""
Write-Host "2. Add and commit your files:" -ForegroundColor Yellow
Write-Host " git add ." -ForegroundColor White
Write-Host " git commit -m 'Initial commit: PRO SOW GPT workflow'" -ForegroundColor White
Write-Host ""
Write-Host "3. Push to GitHub:" -ForegroundColor Yellow
Write-Host " git branch -M main" -ForegroundColor White
Write-Host " git push -u origin main" -ForegroundColor White
Write-Host ""
Write-Host "4. Verify the integration:" -ForegroundColor Yellow
Write-Host " https://github.com/surajdeval/PRO_SOW_GPT" -ForegroundColor White
Write-Host ""