> For the complete documentation index, see [llms.txt](https://wiki.nushackers.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.nushackers.org/orbital/git/advanced-concepts/ignoring-files.md).

# Ignoring Files

Certain projects may include private files (like secrets) or downloaded content (like dependencies). Such files may contain very sensitive information or very large amounts of data and they should not be included in ANY snapshots of the project.

This is where ignoring files with `.gitignore` comes into play.

## Using .gitignore

To start, let's create a new file `secrets.txt`:

```
touch secrets.txt
```

If you run `git status`, you will notice that Git prompts you to stage `secrets.txt`. But we don't want that to happen. So we can add a file `.gitignore` and add the path to `secrets.txt`:

```
echo "secrets.txt" >> .gitignore
```

Then, when you run `git status` again, you will notice that Git no longer prompts you to stage `secrets.txt`. Wonderful!

## Predefined .gitignore

You can find a set of predefined `.gitignore` files here: <https://github.com/github/gitignore>

We highly recommend going with them for any project so that you are not redefining/missing any common files and folders that should be ignored.

When creating a repository on Github, can select a predefined `.gitignore` to be added in the repository so you can save a step of adding the file

<figure><img src="/files/8GRZrvznjtcC6Lea9hzB" alt=""><figcaption></figcaption></figure>

## What to ignore?

Typically, we ignore files like build artifacts and generated files that are usually derived from the human-authored code in the repository.

* Dependency caches like `/node_modules`
* Compiled code like `.o`, `.pyc` files
* Build output directories like `/bin`, `/out`
* Runtime-generated files like log files
* Personal configuration files e.g. of your IDE

## Further reading on ignoring files on git

* <https://git-scm.com/docs/gitignore>
* <https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files>
