soiz commited on
Commit
2eadae7
·
verified ·
1 Parent(s): a179be7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+
3
+ def clone_github_repo(repo_url, destination_folder=None):
4
+ """
5
+ GitHubリポジトリをクローンします。
6
+
7
+ :param repo_url: クローンするリポジトリのURL
8
+ :param destination_folder: 保存先フォルダのパス(指定しない場合、リポジトリ名が使用されます)
9
+ """
10
+ try:
11
+ # destination_folderが指定されていない場合、リポジトリ名を取得して設定する
12
+ if destination_folder is None:
13
+ destination_folder = repo_url.split('/')[-1].replace('.git', '')
14
+
15
+ # git clone コマンドを実行
16
+ subprocess.run(["git", "clone", repo_url, destination_folder], check=True)
17
+ print(f"リポジトリ {repo_url} を {destination_folder} にクローンしました。")
18
+ except subprocess.CalledProcessError as e:
19
+ print(f"リポジトリのクローンに失敗しました: {e}")
20
+
21
+ # 使用例
22
+ repo_url = "https://github.com/NebulaServices/Nebula"
23
+ clone_github_repo(repo_url)