Spaces:
Sleeping
Sleeping
Upload hfdl.py
Browse files
hfdl.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import git
|
3 |
+
|
4 |
+
def download_repo(repo_url: str, destination: str = "repo"):
|
5 |
+
"""Clones a Git repository to a specified destination."""
|
6 |
+
if os.path.exists(destination):
|
7 |
+
print(f"Removing existing directory: {destination}")
|
8 |
+
os.system(f"rm -rf {destination}")
|
9 |
+
|
10 |
+
print(f"Cloning {repo_url} into {destination}...")
|
11 |
+
git.Repo.clone_from(repo_url, destination)
|
12 |
+
print("Clone completed!")
|
13 |
+
|
14 |
+
if __name__ == "__main__":
|
15 |
+
REPO_URL = os.getenv("REPO_URL", "https://github.com/taellinglin/Carmen.git") # Change to desired repo
|
16 |
+
DEST_DIR = os.getenv("DEST_DIR", "repo")
|
17 |
+
|
18 |
+
download_repo(REPO_URL, DEST_DIR)
|