neuralese_temp / scripts /push_code_to_github.sh
psidharth567's picture
Add scripts to push cache to HF and code to GitHub
fb55f63
#!/usr/bin/env bash
# Push only tracked source (cache/ and .env stay ignored via .gitignore).
#
# Create an empty GitHub repo first, then either:
# export GITHUB_REPO_URL='https://github.com/USER/neuralese.git'
# bash scripts/push_code_to_github.sh
# or use SSH:
# export GITHUB_REPO_URL='git@github.com:USER/neuralese.git'
#
# For HTTPS you will be prompted for credentials unless you use a PAT in the URL
# (avoid committing PATs).
set -eo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
cd "${REPO_ROOT}"
if [[ -z "${GITHUB_REPO_URL:-}" ]]; then
echo "Set GITHUB_REPO_URL to your empty GitHub repo clone URL." >&2
exit 1
fi
if git remote get-url github &>/dev/null; then
git remote set-url github "${GITHUB_REPO_URL}"
else
git remote add github "${GITHUB_REPO_URL}"
fi
git push -u github main
echo "Pushed code to ${GITHUB_REPO_URL}"