Spaces:
Running
Running
| cd "$(dirname "$0")" | |
| echo "Pushing updated files to GitHub..." | |
| echo | |
| read -s -p "Paste your GitHub token: " TOKEN | |
| echo | |
| USERNAME=$(curl -s -H "Authorization: token $TOKEN" https://api.github.com/user | python3 -c "import sys,json; print(json.load(sys.stdin).get('login',''))" 2>/dev/null) | |
| if [ -z "$USERNAME" ]; then | |
| echo "Token invalid. Try again." | |
| read -p "Press Enter to close..."; exit 1 | |
| fi | |
| echo "Logged in as: $USERNAME" | |
| REMOTE_URL="https://${USERNAME}:${TOKEN}@github.com/${USERNAME}/trade-copilot.git" | |
| git remote remove origin 2>/dev/null || true | |
| git remote add origin "$REMOTE_URL" | |
| git add -A | |
| git commit -m "Add Dockerfile and HF Spaces config" 2>/dev/null || echo "Nothing new to commit" | |
| git push -u origin main --force | |
| git remote remove origin 2>/dev/null || true | |
| git remote add origin "https://github.com/${USERNAME}/trade-copilot.git" | |
| echo | |
| echo "Done! GitHub is up to date." | |
| echo | |
| read -p "Press Enter to close..." | |