Published: 07 September 2017
At Auth0 we develop a lot of sample applications to show developers how to use our various features inside their applications. These applications invariably require some sort of configuration which is read from a file.
For our Angular Quickstarts for example, there is a file called
auth0-variables.ts.example which contains an example of the settings required for the application to run.
When a user downloads or forks this example to run it locally, they need to simply rename that file to
auth0-variables.ts and replace the placeholder values inside the file with the value for their own Auth0 configuration.
When we (as Auth0 employees) work on these example applications, we obviously also need to do this, but we need to take care not to actually check that file into source control.
Well, that easy you’ll say. Just add the file to
Yes, that will solve the issue, but it would also create a potential issue for the customers, because it means their own copy of this file will never get checked into source control. Unless of course they remove the entry from the
Well it turns out there is another way.
In Git, you can exclude a file locally - i.e. only on the current computer.
.git folder for your project, there is a file
/info/exclude. This file has the exact same structure as a
.gitignore file, so you can add the file patterns for any files which must be excluded locally, inside that file.
Here is the relevant section from the Git documentation:
Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the
Hat tip to this great StackOverflow answer.
PS: If you found this content valuable and want to return the favour, then please feel free to ☕ buy me a coffee ☕
Are you struggling to stay up to date with all that is happening in the ASP.NET world?
I publish a weekly newsletter with all the best ASP.NET related news and blog posts of the previous week
Sign up with your email address below to get it delivered to your Inbox every Friday!