Search code examples
gitgitignore

How should I hide my googleservices.json file using .gitignore?


I want to hide my googleservices.json from git, thus I want to add it to the .gitignore file. My googleservices.json file is located inside android/app/googleservices.json

When I add this location to the .gitignore file, it still tracks it, What should I do?


Solution

  • If you already committed it once, you will have to explicitly remove it. git rm will do that.

    However, if you already committed, it is forever visible in your repo's history. If you want to remove it from history, you will have to rebase the entire repo as if the commit that added the file never existed, or simply start over from scratch.

    See also: How to permanently delete a file stored in GIT?