user13433173
user13433173

Reputation:

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??

Upvotes: 3

Views: 6162

Answers (3)

Godwin Mathias
Godwin Mathias

Reputation: 524

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

Usage:

 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.

Upvotes: 0

Shantanu Sharma
Shantanu Sharma

Reputation: 692

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

Upvotes: 4

Taym95
Taym95

Reputation: 2510

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!

Upvotes: 10

Related Questions