Why doesn't expo-cli create a .gitignore file?


I am new to expo and I just created a new project using expo init my-new-project per the quickstart instructions on Introduction to Expo - Expo Documentation. I was expecting this command to have created a .gitignore file, because I don’t know the expo file/directory structure and so don’t know what should be gitignored. I know that in general node_modules should be gitignored, but what about this directory .expo that shows up after I connect a device? Thanks for your response!

1 Like

Hey @carlgieringer,

I just tested the expo init command, and it did create .gitignore file.
It doesn’t show up in Finder, but in VS Code I can see it in the list of files on the left.

Let me know if you find it!

Huh! I still can’t find it. Can you see what I am doing wrong?

$ expo init my-new-project
? Choose a template: expo-template-blank
✔ Please enter a few initial configuration values.
  Read more: https://docs.expo.io/versions/latest/workflow/configuration/ · 100% completed
? Yarn v1.10.1 found. Use Yarn to install dependencies? No
Extracting project files...
Customizing project...
Initialized a git repository.
Installing dependencies...
npm WARN lifecycle The node binary used for scripts is /Users/me/.nodenv/shims/node but npm is using /usr/local/Cellar/node/10.11.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> fsevents@1.2.7 install /Users/me/code/my-new-project/node_modules/fsevents
> node install

node-pre-gyp WARN Using needle for node-pre-gyp https download
[fsevents] Success: "/Users/me/code/my-new-project/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN expo-google-sign-in@2.0.0 requires a peer of react-native@^0.55.4 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-reanimated@1.0.0-alpha.11 requires a peer of react@16.0.0-alpha.6 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-reanimated@1.0.0-alpha.11 requires a peer of react-native@^0.44.1 but none is installed. You must install peer dependencies yourself.
npm WARN url-loader@1.1.2 requires a peer of webpack@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.

added 927 packages from 442 contributors and audited 19893 packages in 14.639s
found 6 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

Your project is ready at /Users/me/code/my-new-project

To get started, you can type:

  cd my-new-project
  npm start

$ ls -al my-new-project
total 616
drwxr-xr-x   11 me  staff   352B Mar  9 12:26 .
drwxr-xr-x   13 me  staff   416B Mar  9 12:26 ..
drwxr-xr-x    9 me  staff   288B Mar  9 12:26 .git
-rw-r--r--    1 me  staff     3B Oct 26  1985 .watchmanconfig
-rw-r--r--    1 me  staff   449B Oct 26  1985 App.js
-rw-r--r--    1 me  staff   555B Mar  9 12:26 app.json
drwxr-xr-x    4 me  staff   128B Mar  9 12:26 assets
-rw-r--r--    1 me  staff   107B Oct 26  1985 babel.config.js
drwxr-xr-x  574 me  staff    18K Mar  9 12:26 node_modules
-rw-r--r--    1 me  staff   284K Mar  9 12:26 package-lock.json
-rw-r--r--    1 me  staff   426B Mar  9 12:26 package.json
$ expo --version

I am having the same experience - no ‘.gitignore’ is created

I’m not very familiar with the expo CLI code, but I did find this interesting comment by searching the repo for “gitignore”:

// TODO: Add .expo/* to *gitignore*


Same experience: no .gitignore. VS Code is going crazy trying to index the content of node_modules.
I did the exact same as the OP, except I used Yarn.

I opened an issue here: https://github.com/expo/expo-cli/issues/433

@charliecruzan could you tell us what should be in the .gitignore file? Currently I have pulled together the following but I have no idea if correct:


I also found this, which looks more comprehensive:

# Expo

# macOS

# Node

# Emacs

# Vim

# Sublime Text

# Xcode

# Android Studio

# Android

# Tools

# Dynamic Macros

# Template files

# Codemod

# Fastlane

# CI

# Shell apps

# Expo Client builds

# Expo web env

Thank you!

@carlgieringer, @robrecord, @sivano

Sorry for the long response time. Turns out that after retesting this (updated Expo CLI to 2.11.9) no .gitignore file is created on my end, either.

Thanks for bringing this up! I’ll be looking into it further.

In the meantime, .gitignore files vary depending on what your project is using. For instance, the most recent one project I’m working on that uses very very few dependencies is:


So it’s tough for me to say exactly what yours should contain. Sorry about this, hope to have this resolved soon.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.