Search code examples
android-studiofluttergitignore

Adding file to git Ignore in flutter


I'm working on making the flutter app and I'm trying to add my "key.properties" file, which includes passwords, into git ignore file. In my android/.gitignore file, I wrote

gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
/key.properties

like this and I thought it makes key.properties file ignored on my git hub, but when I push the code, I still can see it on GitHub. Is the way I write correct??


Solution

  • I suspect you added the key.properties line to .gitignore after that file had been committed.

    What you need to do is the following:

    git rm --cached key.properties

    **/android/key.properties should be added to .gitignore!