What should I put in a meteor .gitignore file?

GitMeteorGitignore

Git Problem Overview


I have a new meteor project. I'm guessing the .meteor dir has a combination of configuration files (needed) and temporary files (not needed).

So what's in your .gitignore?

Git Solutions


Solution 1 - Git

The only directory you want excluded from version control is .meteor/local.

Meteor automatically creates the right .meteor and .meteor/.gitignore, though -- you shouldn't need to do anything.

Solution 2 - Git

You might want to put any configuration settings files in there if you are pushing to a public repos.

I store any security sensitive data configuration settings like encryption keys and various passwords for services like smtp, twitter, facebook and others in a config.js and then put that in .gitignore or in the info/exclude file. Stuff I don't want in a public repo.

Just an additional suggestion to consider for your .gitignore

Solution 3 - Git

Your gitignore should also contain:

public/node_modules

And you supplement this with a properly crafted package.json that manages node module dependency installation.

This will necessitate a npm install when installed somewhere new.

Solution 4 - Git

According to this article, you should ignore your settings.json, especially if you have environment specific information to include API keys.

Solution 5 - Git

With meteor 1.3 you want to also ignore node_modules. There is no reason to have all of the libraries added to git because you can install them through npm. The node_modules folder most likely is larger than your app (excluding the .meteor/local folder)

Solution 6 - Git

Meteor creates a .gitignore in the .meteor directory by default.

However, your project's .gitignore should exclude any sensitive data config files and node_modules.

Solution 7 - Git

if you use

if you are mac user you can ignore DS_Store

and if you use npm ignore npm cause if both windows and mac user work on same project, as the same npm version is different for mac and windows it shows error.

Solution 8 - Git

Here is what I use with Webstorm and Meteor 1.4 deployed with Mupx.

# Meteor files to ignore now handled by .ignore file within .Meteor folder automatically

# settings file to ignore to protect API keys
settings.json

# MUP / MUPX file to ignore to protect server passwords and sensitive info.
mup.json

# npm package files to ignore
node?modules/
npm-debug.log

# Webstorm IDE files to ignore
.idea/*

# Typing type definition files to ignore. Webstorm uses type definitions for autocomplete even without typescript
typings/*

Solution 9 - Git

We use this gitignore, which englobes many IDEs and Meteor, along system files and others.

### WebStorm ###
.idea/

### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows shortcuts
*.lnk

### Linux ###
*~
# KDE directory preferences
.directory

### SublimeText ###
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# workspace files are user-specific
*.sublime-workspace
# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project
# sftp configuration file
sftp-config.json

### Node/NPM ###
node_modules
npm-debug.log

### Development ###
dump
mochawesome-reports
ngrok

Solution 10 - Git

you will need to put installed packages directory named node_modules which is located in root directory. and while you commit project it will be ignored. also product manager can easily install packages in their server using package.json.

Solution 11 - Git

### MeteorJS ###
# default meteor build and local packages
.meteor/local

# meteor settings file
settings.json

# meteor build output files
*.tar.gz

# general swp files from vim
*.swp

# End of https://www.gitignore.io/api/meteorjs

Solution 12 - Git

This is the .gitignore file I use with Intellij:

  node_modules/
  .meteor/local/*
  .idea/
  npm-debug.log
  packages/*/.npm/

Solution 13 - Git

you can use this site https://www.gitignore.io/ to generate a .gitignore file for any project , just insert the thechnologies you use and your IDE

Solution 14 - Git

  1. gitignore is used to ignore all the unnecessary burden over the git server and your fetching all the time.
  2. So the best possible stuff to put inside the gitignore is packagable entity. Now, this includes the meteor downloadable packages, so, you should just add ".meteor/local" inside gitignore.
  3. When you add it to gitignore configuration, it reduces the size of project to n times smaller as it would be with the packages.
  4. If you cut-paste the entire project now to different location or fetch the repository without .meteor/local folder and start the project using meteor command, the meteor first downloads the required packages and then starts the server.

Solution 15 - Git

.meteor/local is the only thing you want missing from version control.

Meteor automatically generates a .gitignore file that would fit your needs.

If it's a public repository you'll likely want to include "settings-development.json" or any other JSON files containing information you don't want to disclose to the public such as AWS API keys.

However Bitbucket and some others provides free private repositories which should fit your needs.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMichael ForrestView Question on Stackoverflow
Solution 1 - GitdebergalisView Answer on Stackoverflow
Solution 2 - GitSteeve CannonView Answer on Stackoverflow
Solution 3 - Gitmatb33View Answer on Stackoverflow
Solution 4 - GitJesseView Answer on Stackoverflow
Solution 5 - GitPatrick Mencias-lewisView Answer on Stackoverflow
Solution 6 - GitDerekView Answer on Stackoverflow
Solution 7 - Gitmonesul haqueView Answer on Stackoverflow
Solution 8 - GitKimmo HintikkaView Answer on Stackoverflow
Solution 9 - GitRaphael AriasView Answer on Stackoverflow
Solution 10 - GitSubotica DmitarView Answer on Stackoverflow
Solution 11 - GitSchubert David RodriguezView Answer on Stackoverflow
Solution 12 - GithusaytView Answer on Stackoverflow
Solution 13 - GitIlyes AtouiView Answer on Stackoverflow
Solution 14 - GitAnkur SoniView Answer on Stackoverflow
Solution 15 - GitBenjamin SampsonView Answer on Stackoverflow