Created
February 14, 2025 13:32
-
-
Save Esonhugh/c059cd2c1914ea4b75be95a1795930ed to your computer and use it in GitHub Desktop.
Revisions
-
Esonhugh created this gist
Feb 14, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ import sys # usage: python cloner.py 1> cloner.sh 2> extract.sh # username = "user" password = "pass_or_token" domain = "github.com" Prefix = f"git clone --mirror https://{username}:{password}@{domain}/" REPOLIST_TXT= "repo_list" # filename contains lists of http/https urls on git def get_git_url(line_arr): return "/".join(line_arr[6:]) def get_dir(line_arr): return "/".join(line_arr[6:]) PrefixClone = f"git clone " ExtractedPrefix = "dec" with open(REPOLIST_TXT, "r") as f: line = "1" count = 1 while line: line = f.readline().strip() line_arr = line.split("/") git_url = get_git_url(line_arr) dir = get_dir(line_arr) print(f"echo current is {count} repo {git_url} clone to {dir}") print(f"{Prefix}{git_url} {dir}") print(f"echo current is {count} local mirror repo {dir} Extracted to {ExtractedPrefix}/{dir}", file=sys.stderr) print(f"{PrefixClone} ./{dir} ./{ExtractedPrefix}/{dir}" ,file=sys.stderr) count+=1