Download scripts/dagshub-auth.sh from santicas/cjfp-data: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/santicas/cjfp-data/resolve/main/scripts/dagshub-auth.sh
- Command line
-
hf download hf://datasets/santicas/cjfp-data/scripts/dagshub-auth.sh
-
curl -L -o dagshub-auth.sh https://huggingface.co/datasets/santicas/cjfp-data/resolve/main/scripts/dagshub-auth.sh
1.44 kB
| set -euo pipefail | |
| script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" | |
| repo_root="$(cd -- "$script_dir/.." && pwd)" | |
| if command -v dvc >/dev/null 2>&1; then | |
| dvc_cmd=(dvc) | |
| elif [[ -x "$repo_root/.venv/bin/dvc" ]]; then | |
| dvc_cmd=("$repo_root/.venv/bin/dvc") | |
| elif command -v uvx >/dev/null 2>&1; then | |
| dvc_cmd=(uvx --from dvc dvc) | |
| else | |
| printf 'Error: DVC/uvx unavailable; install DVC before configuring Git auth.\n' >&2 | |
| exit 2 | |
| fi | |
| if ! username="$(cd "$repo_root" && "${dvc_cmd[@]}" config --local remote.dagshub.user 2>/dev/null)" \ | |
| || ! password="$(cd "$repo_root" && "${dvc_cmd[@]}" config --local remote.dagshub.password 2>/dev/null)" \ | |
| || [[ -z "$username" || -z "$password" ]]; then | |
| printf 'Error: configure DagsHub credentials in ignored .dvc/config.local first.\n' >&2 | |
| exit 2 | |
| fi | |
| # Do not leave the secret in this setup process's environment or output. | |
| unset password | |
| helper="$repo_root/scripts/git-credential-dagshub" | |
| git -C "$repo_root" config --local --replace-all credential.https://dagshub.com.helper "" | |
| git -C "$repo_root" config --local --add credential.https://dagshub.com.helper "$helper" | |
| git -C "$repo_root" config --local credential.https://dagshub.com.useHttpPath true | |
| printf 'Configured repo-local Git auth for https://dagshub.com/santiagacasas/cjfp-data.git\n' | |
| printf 'Git will reuse the account username and token from ignored DVC local config.\n' | |