0

I am building a react native application in which I don't want to push android and ios directories to github. No matter what I am writing in .gitignore file, these two directories are always being pushed to the github. Following are the patterns that I have used in .gitignore:

1. android 
   ios
2. /android/*
   /ios/*
3. android/
   ios/
4. /android
   /ios

Please tell me how can I prevent these folders from going to github?

Thanks!!

Guys the numbering and indentation is not real. I have used them just to depict how many ways I have tried.

Vipul Tyagi
  • 547
  • 3
  • 11
  • 29
  • You have some formatting issues. You should not use ordered lists in .gitignore. Also, I never tried heading whitespaces in a name, but I suggest caution. That is to say, I don't think you have a folder named "2. /android/" and, even if you have, you'll probably need to escape the whitespace. – Daemon Painter Nov 16 '20 at 08:45
  • 1) Do you really have number bullets and indents in your `.gitignore`? 2) `.gitignore` is not about _pushing_, it's about _adding to index_ therefore _committing_. – terrorrussia-keeps-killing Nov 16 '20 at 09:20
  • it is solved by following the given answer. – Vipul Tyagi Nov 16 '20 at 10:42

1 Answers1

1

First, you have to add these lines to .gitignore

android/
ios/

Then follow the answer below to untrack committed folders:

Ignore files that have already been committed to a Git repository

Anh Duc Ng
  • 169
  • 1
  • 8