Support: What is the git .ignore file used for?

Created on 8 Aug 2020  路  5Comments  路  Source: EddieHubCommunity/support

Description

A brief description of the question or issue:

You can also join the discord community here

Feel free to check out other cool repositories of EddieJoaude Comminity here

question solved

Most helpful comment

A .gitignore file inside of the root directory of your project, will contain a list of files and folders that you don't want to be uploaded to your GitHub repository when you use git push or upload it with the GitHub Desktop app.

An example of a smaller .gitignore file might look like this:

node_modules
.env

# local env files
.env.local
.env.*.local

Where node_modules (if it's a NodeJS project) is important because you don't want tens of thousands of files in your node_modules folder to be uploaded, and .env is also very important not to upload because that file usually contains sensitive information, such as API keys and Auth tokens for example.

All 5 comments

A .gitignore file inside of the root directory of your project, will contain a list of files and folders that you don't want to be uploaded to your GitHub repository when you use git push or upload it with the GitHub Desktop app.

An example of a smaller .gitignore file might look like this:

node_modules
.env

# local env files
.env.local
.env.*.local

Where node_modules (if it's a NodeJS project) is important because you don't want tens of thousands of files in your node_modules folder to be uploaded, and .env is also very important not to upload because that file usually contains sensitive information, such as API keys and Auth tokens for example.

So if someone download that REPOSITORY and try to run it, it works properly but they can't see sensitive information which we include in Git.ignore file, Right?

A . gitignore file is a plain text file where you can list out your files/directories to be ignored from being committed or pushed to your remote repo.

You can also refer to this post by freecodecamp - Gitignore Explained: What is Gitignore and How to Add it to Your Repo

So if someone download that REPOSITORY and try to run it, it works properly but they can't see sensitive information which we include in Git.ignore file, Right?

Yeah! So, You might have a file like .env which might contain sensitive information like your private API keys or something like that. So, by listing that file in . gitignore is going to prevent it from being committed or pushed to GitHub where people might use your private stuff with malicious intent.

oh i got it, thanks @jatin2003

Was this page helpful?
0 / 5 - 0 ratings

Related issues

schmelto picture schmelto  路  5Comments

jai-dewani picture jai-dewani  路  4Comments

Jmimoni picture Jmimoni  路  3Comments

eddiejaoude picture eddiejaoude  路  4Comments

ChoukseyKhushbu picture ChoukseyKhushbu  路  4Comments