Spaces:
Sleeping
Sleeping
| 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') | |