【发布时间】:2012-05-30 12:48:03
【问题描述】:
我有一个新的流星项目。我猜.meteor 目录有配置文件(需要)和临时文件(不需要)的组合。
那么你的.gitignore 里有什么?
【问题讨论】:
-
settings.json特别是如果你有 API 令牌。 -
我使用 webstorm,我的 .gitignore 中唯一的一行是
.idea/
我有一个新的流星项目。我猜.meteor 目录有配置文件(需要)和临时文件(不需要)的组合。
那么你的.gitignore 里有什么?
【问题讨论】:
settings.json 特别是如果你有 API 令牌。
.idea/
.meteor/local 是您唯一希望从版本控制中删除的内容。
Meteor 会自动生成一个符合您需要的 .gitignore 文件。
如果它是一个公共存储库,您可能希望包含“settings-development.json”或任何其他包含您不想向公众披露的信息(例如 AWS API 密钥)的 JSON 文件。
但是,Bitbucket 和其他一些提供了免费的私有存储库,应该可以满足您的需求。
【讨论】:
您可以使用此站点https://www.gitignore.io/ 为任何项目生成 .gitignore 文件,只需插入您使用的技术和您的 IDE
【讨论】:
### 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
【讨论】:
您需要将已安装的包目录放在根目录中名为 node_modules 的目录中。当您提交项目时,它将被忽略。产品经理也可以使用 package.json 在他们的服务器上轻松安装包。
【讨论】:
我们使用这个 gitignore,它包含许多 IDE 和 Meteor,以及系统文件和其他文件。
### 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
【讨论】:
这是我在 Intellij 中使用的 .gitignore 文件:
node_modules/
.meteor/local/*
.idea/
npm-debug.log
packages/*/.npm/
【讨论】:
这是我在 Webstorm 和 Meteor 1.4 中使用 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/*
【讨论】:
【讨论】:
对于meteor 1.3,您还想忽略node_modules。没有理由将所有库添加到 git,因为您可以通过 npm 安装它们。 node_modules 文件夹很可能比您的应用程序大(不包括 .meteor/local 文件夹)
【讨论】:
如果你使用
.idea文件夹sublime-projectsublime-workspace
如果你是mac用户可以忽略DS_Store
如果你使用 npm 忽略 npm 会导致如果 windows 和 mac 用户都在同一个项目上工作,因为相同的 npm 版本对于 mac 和 windows 是不同的,它会显示错误。
【讨论】:
您希望从版本控制中排除的唯一目录是.meteor/local。
Meteor 会自动创建正确的 .meteor 和 .meteor/.gitignore,不过,您不需要做任何事情。
【讨论】:
settings.json 存储 API 密钥,则应忽略它。
Meteor 默认在.meteor 目录中创建一个.gitignore。
但是,您项目的 .gitignore 应排除任何敏感数据配置文件和 node_modules。
【讨论】:
根据this article,您应该忽略您的settings.json,特别是如果您有环境特定信息以包含API 密钥。
【讨论】:
你的 gitignore 还应该包含:
公共/node_modules
然后你用一个管理节点模块依赖安装的properly crafted package.json 来补充它。
当安装在新的地方时,这将需要 npm install。
【讨论】:
如果您要推送到公共存储库,您可能希望将任何配置设置文件放在那里。
我将任何安全敏感数据配置设置(如加密密钥和各种密码)存储在 config.js 中,然后将其放入 .gitignore 或 info/exclude 文件中。我不希望在公共回购中的东西。
只是为您的 .gitignore 考虑的额外建议
【讨论】:
settings.json 中发布您的社交媒体和 AWS 令牌。