adaptai / platform /aiml /mlops /sync /setup_remotes.sh
ADAPT-Chase's picture
Add files using upload-large-folder tool
0daf510 verified
#!/usr/bin/env bash
set -euo pipefail
# Creates remotes and repos if missing:
# - GitHub: adaptnova/e-zeropoint (private)
# - Hugging Face: LevelUp2x/e-zeropoint (model, private)
GH_ORG=${GH_ORG:-adaptnova}
GH_REPO=${GH_REPO:-e-zeropoint}
HF_NS=${HF_NS:-LevelUp2x}
HF_REPO=${HF_REPO:-e-zeropoint}
echo "[sync] Target GH: ${GH_ORG}/${GH_REPO} | HF: ${HF_NS}/${HF_REPO}"
# Ensure we are inside a git repo
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || { echo "[sync] Not a git repo" >&2; exit 1; }
# GitHub (gh CLI)
if command -v gh >/dev/null 2>&1; then
if ! gh repo view "${GH_ORG}/${GH_REPO}" >/dev/null 2>&1; then
echo "[sync] Creating GH repo ${GH_ORG}/${GH_REPO} (private)"
gh repo create "${GH_ORG}/${GH_REPO}" --private --confirm || true
else
echo "[sync] GH repo exists"
fi
if ! git remote get-url gh >/dev/null 2>&1; then
git remote add gh "https://github.com/${GH_ORG}/${GH_REPO}.git" || true
fi
else
echo "[sync] gh CLI not found; skipping GH repo create"
fi
# Hugging Face (huggingface-cli or hf)
HF_REMOTE_URL="https://huggingface.co/${HF_NS}/${HF_REPO}"
created=0
if command -v huggingface-cli >/dev/null 2>&1; then
echo "[sync] Ensuring HF repo via huggingface-cli"
huggingface-cli repo create "${HF_REPO}" --organization "${HF_NS}" --type model --private -y && created=1 || true
elif command -v hf >/dev/null 2>&1; then
echo "[sync] Ensuring HF repo via hf CLI"
hf api create-repo --repo-type model --name "${HF_REPO}" --organization "${HF_NS}" --private && created=1 || true
else
echo "[sync] No HF CLI found; skipping HF repo create (install huggingface_hub[cli])"
fi
if ! git remote get-url hf >/dev/null 2>&1; then
git remote add hf "${HF_REMOTE_URL}" || true
fi
echo "[sync] Remotes now:"; git remote -v