-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_github_repo.py
More file actions
43 lines (32 loc) · 1.19 KB
/
Copy pathsetup_github_repo.py
File metadata and controls
43 lines (32 loc) · 1.19 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
import subprocess
import os
# Set your GitHub repo URL here
GITHUB_URL = "https://github.com/iamdpsingh/Vendor_Performance_Analysis-.git" # <-- Replace this
# File types to be tracked by Git LFS
LFS_FILE_TYPES = ["*.csv", "*.pkl", "*.h5", "*.zip", "*.pt"]
# File types to ignore (not upload)
IGNORE_FILE_TYPES = ["*.db"]
def run(cmd):
print(f"⚙️ {cmd}")
subprocess.run(cmd, shell=True, check=True)
def update_gitignore():
print("📝 Updating .gitignore with ignored file types...")
with open(".gitignore", "a") as gitignore:
for filetype in IGNORE_FILE_TYPES:
gitignore.write(f"{filetype}\n")
def setup_github_repo():
run("git init")
run("git lfs install")
for filetype in LFS_FILE_TYPES:
run(f'git lfs track "{filetype}"')
update_gitignore()
run("git add .gitattributes")
run("git add .gitignore")
run("git add .")
run('git commit -m "Initial commit with LFS and .gitignore" || echo \"Nothing to commit\"')
run("git remote remove origin || true")
run(f"git remote add origin {GITHUB_URL}")
run("git branch -M main")
run("git push -u origin main --force")
if __name__ == "__main__":
setup_github_repo()