-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_git.ps1
More file actions
64 lines (51 loc) · 1.88 KB
/
Copy pathsetup_git.ps1
File metadata and controls
64 lines (51 loc) · 1.88 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
# setup_git.ps1
# Initialize the git repository, create the first commit, set the remote,
# and push to GitHub. Run from the project root in PowerShell.
#
# Pre-req: create the empty repo at https://github.com/new first.
# Do NOT add a README, license, or .gitignore on GitHub.
$ErrorActionPreference = "Continue"
$RepoUrl = "https://github.com/srikanthbaride/multimodal-precursor-detection.git"
$UserName = "Srikanth Baride"
$UserMail = "srikanthb@iiitd.ac.in"
Set-Location -LiteralPath $PSScriptRoot
# Log everything to a file so we can audit failed runs.
$LogFile = Join-Path $PSScriptRoot "setup_git.log"
Start-Transcript -Path $LogFile -Force | Out-Null
# Make sure the PowerShell window stays open no matter what.
trap {
Write-Host ""
Write-Host "ERROR: $_" -ForegroundColor Red
Write-Host ""
Stop-Transcript | Out-Null
Read-Host "Press Enter to close"
exit 1
}
if (Test-Path .git) {
Write-Host "Already a git repo. Skipping init." -ForegroundColor Yellow
} else {
Write-Host "Initializing git..." -ForegroundColor Cyan
git init -b main
}
git config user.name $UserName
git config user.email $UserMail
Write-Host "Staging all files (respecting .gitignore)..." -ForegroundColor Cyan
git add -A
Write-Host ""
Write-Host "Committing the following files:" -ForegroundColor Cyan
git status --short
Write-Host ""
git commit -m "Initial commit: multimodal precursor detection (synthetic-data research prototype)"
# Add or update remote
if (git remote | Select-String -Quiet "^origin$") {
git remote set-url origin $RepoUrl
} else {
git remote add origin $RepoUrl
}
Write-Host "Pushing to $RepoUrl ..." -ForegroundColor Cyan
git push -u origin main
Write-Host ""
Write-Host "Done. Repo is live at https://github.com/srikanthbaride/multimodal-precursor-detection" -ForegroundColor Green
Write-Host ""
Stop-Transcript | Out-Null
Read-Host "Press Enter to close"