File size: 696 Bytes
ca2863a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import subprocess
import sys
from dotenv import load_dotenv

load_dotenv()
HF = os.getenv('HF')
"""
ARCHIVED: push_to_space.py

Not required in the deployed Space. Kept as an archive placeholder.
"""
subprocess.run(['git','remote','add','origin', remote_with_token], check=True)
subprocess.run(['git','branch','-M','main'], check=False)
print('Pushing to remote...')
res = subprocess.run(['git','push','-u','origin','main'], check=False)
if res.returncode != 0:
    print('git push failed with code', res.returncode)
    sys.exit(res.returncode)
# replace remote with tokenless url
subprocess.run(['git','remote','set-url','origin', remote_no_token], check=True)
print('Push complete')