Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env.example is gitignored in starter templates #2925

Closed
gtm-nayan opened this issue Nov 26, 2021 · 1 comment · Fixed by #2926
Closed

.env.example is gitignored in starter templates #2925

gtm-nayan opened this issue Nov 26, 2021 · 1 comment · Fixed by #2926

Comments

@gtm-nayan
Copy link
Contributor

Describe the problem

#2905 made it so that .gitignore in the starter templates ignores all files starting with .env.. This also includes .env.example files. They are often used for other contributors/users to get a quick overview of the enviroment variables used within the project. These don't contain any secrets so they are safe to be tracked by git.

Describe the proposed solution

Include .env.example using the exclamation point pattern in .gitignore.

An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, "\!important\!.txt".
Source

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

@coyotte508
Copy link
Contributor

From the way SvelteKit handles environment, it would make sens to change this:

  • ignore .env.local and .env.*.local
  • do not ignore .env or .env.{production,development,test}

SvelteKit refers to how Vite handles env

The .env.*.local files override the .env files, and Vite recommend ignoring the local files but not the other.

It's helpful if we want to make cloning a project friendly - there is no need to recreate a .env file locally each clone, the developer can directly start their project, and if they want to tune their config further they can create a .env.local file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants