-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_git_and_sync.py
More file actions
32 lines (26 loc) · 1.24 KB
/
Copy pathsetup_git_and_sync.py
File metadata and controls
32 lines (26 loc) · 1.24 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
import os
import subprocess
PROJECT_DIR = os.path.expanduser("~/str8zero_engine")
def run_cmd(command):
print(f" [+] Executing: {command}")
result = subprocess.run(command, shell=True, cwd=PROJECT_DIR, text=True)
if result.returncode != 0:
print(f" [!] Notice on command (may already exist): {command}")
def initialize_and_sync():
print(f"[Str8Zero Git Setup] Initializing repository at: {PROJECT_DIR}")
os.chdir(PROJECT_DIR)
# Initialize git if not already present
if not os.path.exists(os.path.join(PROJECT_DIR, ".git")):
run_cmd("git init")
run_cmd("git branch -M main")
run_cmd("git remote add origin https://github.com/Str8ZeroOS/str8zero_engine.git")
print(" [✓] Git repository initialized and remote linked to Str8ZeroOS.")
else:
print(" [i] Git repository already exists.")
# Stage, commit, and push
run_cmd("git add .")
run_cmd('git commit -m "Field terminal sync from A1286 client deck" || echo "No changes to commit"')
run_cmd("git push -u origin main || echo 'Ensure remote branch exists or authentication is configured'")
print("[Str8Zero Sync] Repository synchronization sequence complete!")
if __name__ == "__main__":
initialize_and_sync()