Qilan2 commited on
Commit
364024f
·
verified ·
1 Parent(s): 28054d1

Update ff.py

Browse files
Files changed (1) hide show
  1. ff.py +11 -7
ff.py CHANGED
@@ -195,13 +195,17 @@ def create_space(type,key = "", value = ""):
195
  telegram_message(BOT_TOKEN, CHAT_ID, f"{HF_ID}下载Dockerfile下载失败,状态码: {response.status_code}")
196
 
197
  # os.system(f"wget -O '/data/{tmp_name}/Dockerfile' https://huggingface.co/datasets/Qilan2/ff/raw/main/Dockerfile")
198
- os.system('git add .')
199
- os.system('git commit -m "0"')
200
- push_result = os.system('git push origin main')
201
- if push_result != 0:
202
- print("推送失败,可能有冲突,尝试拉取并合并...")
203
- os.system('git pull origin main --rebase')
204
- os.system('git push origin main')
 
 
 
 
205
  def get_latest_local_package(directory, pattern='*.tar.gz'):
206
  try:
207
  # 构建完整的搜索路径
 
195
  telegram_message(BOT_TOKEN, CHAT_ID, f"{HF_ID}下载Dockerfile下载失败,状态码: {response.status_code}")
196
 
197
  # os.system(f"wget -O '/data/{tmp_name}/Dockerfile' https://huggingface.co/datasets/Qilan2/ff/raw/main/Dockerfile")
198
+ repo_path = f"/data/{tmp_name}"
199
+ subprocess.run(["git", "-C", repo_path, "add", "."], check=True)
200
+ subprocess.run(["git", "-C", repo_path, "commit", "-m", commit_message], check=True)
201
+ subprocess.run(["git", "-C", repo_path, "push", "origin", "main"], check=True)
202
+ # os.system('git add .')
203
+ # os.system('git commit -m "0"')
204
+ # push_result = os.system('git push origin main')
205
+ # if push_result != 0:
206
+ # print("推送失败,可能有冲突,尝试拉取并合并...")
207
+ # os.system('git pull origin main --rebase')
208
+ # os.system('git push origin main')
209
  def get_latest_local_package(directory, pattern='*.tar.gz'):
210
  try:
211
  # 构建完整的搜索路径