本文共 2541 字,大约阅读时间需要 8 分钟。
git 初始化git存储库
You should not commit these four types of files into your Git repository.
您不应将这四种类型的文件提交到Git存储库中。
Files like .DS_Store
(for Mac OS), Thumds.db
(for Windows), .vscode
(for code editors) have nothing to do with your project.
.DS_Store
(对于Mac OS), Thumds.db
(对于Windows) .vscode
(对于代码编辑器)等文件与您的项目无关。
They should not be checked in.
他们不应该签入。
This includes files from preprocessors (like Sass to CSS). You don’t check in the CSS. You check in the Sass files.
这包括来自预处理器的文件(例如Sass到CSS)。 您无需签入CSS。 您签入Sass文件。
If you use JavaScript compilers like Webpack or Rollup, you don’t check in the generated JavaScript file. You check in the code you write.
如果使用Webpack或Rollup之类JavaScript编译器,则不要签入生成JavaScript文件。 您检入编写的代码。
If you don’t use a package manager, you should check in your libraries. This is because if you want to download the library, you have to:
如果您不使用包管理器,则应签入库。 这是因为如果要下载该库,则必须:
This process is tedious. If your code needs the library to work, you should check in the library.
这个过程很繁琐。 如果您的代码需要库运行,则应签入库。
On the other hand, if you use a package manager, you shouldn’t check in a library because you can install the library with a single command like npm install
.
另一方面,如果使用软件包管理器,则不应签入库,因为可以使用单个命令(如npm install
。
You shouldn’t store credentials like usernames, passwords, API keys and API secrets.
您不应存储用户名,密码,API密钥和API机密之类的凭据。
If someone else steals your credentials, they can do nasty things with it. I almost lost $40,00 to $60,000 because a friend accidentally exposed my amazon credentials. Luckily, the amount was waived.
如果其他人窃取了您的凭据,则他们可以用它来处理令人讨厌的事情。 我几乎损失了$ 40,00到$ 60,000,因为一个朋友不小心暴露了我的亚马逊凭据。 幸运的是,该金额被免除。
If you don’t want to get into sticky situations like I did, then don’t store your credentials in a Git repository.
如果您不想像我那样陷入困境,那么不要将您的凭据存储在Git存储库中。
Thanks for reading. Did this article help you in any way? If you did, . You might help someone out. Thank you!
谢谢阅读。 本文对您有任何帮助吗? 如果这样做, 。 您可能会帮助某人。 谢谢!
This article was originally posted at .Sign up for my if you want more articles to help you become a better frontend developer.
本文最初发布在 。 如果您想获得更多文章来帮助您成为更好的前端开发人员,请注册我的 。
翻译自:
git 初始化git存储库
转载地址:http://zbewd.baihongyu.com/