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


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 1: Taym95

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!

Solution 2: Shantanu Sharma

Adding file in .gitignore there is some step

If file is not exist in folder

1) then create file then add into .gitignore

If file is already exist so you want to add in .gitignore

1) delete file (Before backup)

2) commit deleted file.

3) add file name into .gitignore

4) commit .gitignore file

Solution 3: Mathias Godwin

If there is any good method to try, It's gibo (.gitgnore boilerplates)


 gibo dump Archives Backup Android Dart DartEditor Emacs Gradle Java JetBrains Jenv Kotlin Linux macOS Maven Objective-C SublimeText Vim VisualStudioCode Windows Xcode >> .gitignore

Many would argue its output is overkill.

Check this thread for some ideas.