diff --git a/packages/mosaic/framework/tools/git/detect-platform.sh b/packages/mosaic/framework/tools/git/detect-platform.sh index e9e1901..626e1a0 100755 --- a/packages/mosaic/framework/tools/git/detect-platform.sh +++ b/packages/mosaic/framework/tools/git/detect-platform.sh @@ -88,9 +88,13 @@ get_gitea_service_for_host() { local host="$1" local cred_file="${MOSAIC_CREDENTIALS_FILE:-}" if [[ -z "$cred_file" ]]; then - # Same resolution chain as _lib/credentials.sh: profile HOME, then host-level. + # Same resolution chain as _lib/credentials.sh: profile HOME, then + # host-level /etc only if it exists; neither existing keeps the + # $HOME default (matches the lib's final := fallback). cred_file="$HOME/.config/mosaic/credentials.json" - [[ -f "$cred_file" ]] || cred_file="/etc/mosaic/credentials.json" + if [[ ! -f "$cred_file" && -f /etc/mosaic/credentials.json ]]; then + cred_file="/etc/mosaic/credentials.json" + fi fi case "$host" in