From e6132b4d334c46a74d87e0b78f1fb1445a347029 Mon Sep 17 00:00:00 2001 From: Misbah Syed <35427888+misbahsy@users.noreply.github.com> Date: Tue, 29 Sep 2026 02:15:21 -0700 Subject: [PATCH] fix(quickstart): ignore an inherited LITELLM_BIND and keep .env ignored outside git Clear LITELLM_BIND from the environment before starting Compose, like the keys and project name, so .env decides the bind address and new installs stay on 127.0.0.1 In an existing folder that is not inside a git repository, add a single .env line to its .gitignore (creating it if needed, without a duplicate), so the keys stay out of commits if the folder later becomes a repository --- scripts/quickstart.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/quickstart.sh b/scripts/quickstart.sh index 3b2bef209f7..c8ca325b6a5 100755 --- a/scripts/quickstart.sh +++ b/scripts/quickstart.sh @@ -165,6 +165,14 @@ pick_folder() { exclude="$(cd "$(dirname "$exclude")" && pwd)/exclude" printf '/%s.env\n' "$(git rev-parse --show-prefix)" >>"$exclude" echo "Added .env to this repository's local git exclude list ($exclude), so your keys stay out of commits." + elif ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + # An existing folder outside git: ignore only .env, so it stays out of + # commits if the folder becomes a repository later. + if ! grep -qxF '.env' .gitignore 2>/dev/null; then + # Start on a new line if the file does not end with one. + if [ -s .gitignore ] && [ -n "$(tail -c 1 .gitignore)" ]; then printf '\n' >>.gitignore; fi + printf '.env\n' >>.gitignore + fi fi } @@ -267,8 +275,9 @@ EOF fi # Compose prefers values already set in the shell over .env, so drop any - # inherited ones: .env stays the only source for keys and the project name. - unset LITELLM_MASTER_KEY LITELLM_SALT_KEY POSTGRES_PASSWORD COMPOSE_PROJECT_NAME + # inherited ones: .env stays the only source for keys, the bind address, + # and the project name. + unset LITELLM_MASTER_KEY LITELLM_SALT_KEY POSTGRES_PASSWORD COMPOSE_PROJECT_NAME LITELLM_BIND echo "Starting LiteLLM and Postgres (the first run downloads the images)..." docker compose -f docker-compose.quickstart.yml up -d