GloSoc-Tec-prj1-EnLearn / cloneTheGit.py
OzoneAsai's picture
Update cloneTheGit.py
46c3368 verified
raw
history blame contribute delete
949 Bytes
import os
import subprocess
import argparse
# パーサーの作成
parser = argparse.ArgumentParser(description="This is a sample script.")
# 引数の定義
parser.add_argument("--key", type=int, help="Your PAT", required=True)
# GitHubリポジトリのURL
repo_url = "https://github.com/OzoneAsai/flashcards.git"
if github_token:
# リポジトリURLにトークンを含めたURLを作成
repo_url_with_token = repo_url.replace("https://", f"https://{github_token}@")
try:
# git clone コマンドを実行
subprocess.run(["git", "clone", repo_url_with_token], check=True)
print("リポジトリのクローンが成功しました。")
except subprocess.CalledProcessError as e:
print(f"クローンに失敗しました: {e}")
else:
print("GitHubトークンが見つかりません。環境変数 'ghKey' または 'PAT' が設定されているか確認してください。")