-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitClone.py
More file actions
33 lines (26 loc) Β· 830 Bytes
/
Copy pathgitClone.py
File metadata and controls
33 lines (26 loc) Β· 830 Bytes
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
import os
import requests
import subprocess
import time
username = "HACKMANV8"
# π£οΈ Define the main path where repos should be stored
base_path = r"/home/kali/Desktop/Projects/Github"
# π Create folder if not exists
target_path = os.path.join(base_path,f"{username}_PROJECTS")
os.makedirs(target_path, exist_ok=True)
# π Move into that folder
os.chdir(target_path)
# π GitHub API
url = f"https://api.github.com/users/{username}/repos?per_page=100"
response = requests.get(url)
repos = response.json()
# print(repos)
repos = repos[:62]
for repo in repos:
name = repo["name"]
clone_url = repo["clone_url"]
print(f"π {name}: {clone_url}")
print(f"π Cloning {name} ...")
subprocess.run(["git", "clone", clone_url])
time.sleep(1)
print(f"π All repos cloned inside: {target_path}")