将文件添加到 git Ignore in flutter

3 gitignore android-studio flutter

我正在制作 flutter 应用程序,并尝试将包含密码的“key.properties”文件添加到 gitignore 文件中。在我的 android/.gitignore 文件中,我写道

gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
/key.properties
Run Code Online (Sandbox Code Playgroud)

像这样,我认为它会使 key.properties 文件在我的 git hub 上被忽略,但是当我推送代码时,我仍然可以在 GitHub 上看到它。我写的方法对吗??

Tay*_*aym 9

我怀疑您在提交该文件后将 key.properties 行添加到 .gitignore 中。

您需要执行以下操作:

git rm --缓存的 key.properties

**/android/key.properties应该添加到.gitignore!