Firebase:我应该将GoogleService-Info.plist添加到.gitignore吗? [英] Firebase: Should I add GoogleService-Info.plist to .gitignore?

查看:68
本文介绍了Firebase:我应该将GoogleService-Info.plist添加到.gitignore吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Firebase用于要开源的iOS项目. 在上传我在Github上共享项目之前,我应该在.gitignore中添加GoogleService-Info.plist吗?

I'm using Firebase for an iOS project that I want to open source. Should I add GoogleService-Info.plist to .gitignore before I upload I share the project on Github?

我知道它包含我的API密钥,客户端ID等,可能不安全公开吗?

I know it contains my API key, client id, etc., which might not be safe to expose?

推荐答案

如果您提交GoogleService-Info.plist并不是世界的尽头(类似地,在Android上,google-services.json),则最好还是将其保留出于一个重要原因:您要明确指出,其他构建您的代码的人应该建立自己的Firebase项目来托管其配置和数据(因为您的项目根本不会丢失该文件,因此无法构建) .此外,如果您的项目中包含可写入世界的资源,那么您会期望拥有如此简单的应用程序和配置的人会不经意间开始将数据写入其中,这可能不是您想要的.

While it's not the end of the world if you commit GoogleService-Info.plist (similarly, on Android, google-services.json), you're better off leaving it out for one big reason: You're making it clear that others who build your code that they should be setting up their own Firebase project to host its configuration and data (because your project simply won't build with that file missing). Furthermore, if your project has world-writable resources in it, you can expect that people who get a hold of your app and config so easily will inadvertently start writing data into it, which is probably not what you want.

理想情况下,需要Firebase设置的开源项目应该在自述文件中指出,任何想要使用此应用程序的人都需要完成Firebase的设置过程.

Open source projects that require a Firebase setup should ideally have it stated in the readme that anyone who wants to work with this app needs to go through the process of setting up Firebase.

这些配置文件中的数据不是完全私有的-可以很容易地从IPA或Android APK中提取它们.在应用程序代码中共享它们可能并不符合您的最大利益.

The data in these config files is not exactly private - they can be extracted fairly easily from an IPA or Android APK. It's just probably not in your best interest to share them as part of your app's code.

这篇关于Firebase:我应该将GoogleService-Info.plist添加到.gitignore吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆