2

I have added multiple folders to my .gitignore files, but they still appear when I do git status.

My installation/computer is new, and I'm trying to init a git repository inside a svn one.

As I've done hundreds of times before (not on this machine though), the folders marked as ignored (notably the .svn folder at the root, and bin and obj inside src/www) should not appear when doing git status, and they should not be added when doing git add ., but they do.

D:\DEV> more .gitignore
.svn/
[Bb]in/
[Oo]bj/
packages/

D:\DEV> git status
On branch master
Untracked files:
(use "git add ..." to include in what will be committed)

    .svn/  
    src/UI.Admin.Tests/obj/  
    src/packages/  
    src/www/bin/  
    src/www/obj/  

nothing added to commit but untracked files present (use "git add" to track)

thomasb
  • 5,816
  • 10
  • 57
  • 92
  • Have these folders already been versioned by Git (i.e. were they previously committed to the repository)? If so, then adding them to `.gitignore` won't work. You will have to `git -rm` them first. – Tim Biegeleisen Jul 06 '16 at 15:28
  • No, I have not ever added these folders. – thomasb Jul 06 '16 at 15:30
  • The folders are showing up as being untracked, which means they will not be committed if you were to do a `git commit`. So there is nothing to worry about. If someone else commits these folders and you pull, your Git will ignore anything coming from the repository. – Tim Biegeleisen Jul 06 '16 at 15:32
  • Yes but they are added if I do a `git add .`. They should not appear at all when doing `git status` – thomasb Jul 06 '16 at 15:36
  • I don't see those `src` files listed in your `.gitignore`. – Tim Biegeleisen Jul 06 '16 at 15:43
  • @AD7six : you're right, I've replaced the screenshot with some text, and added more explanation as to what I'm expecting. – thomasb Jul 06 '16 at 15:44
  • @TimBiegeleisen : yes, it's the `.svn/` folder at the root that should be ignored, as well as the `bin` and `obj` folders inside `src/www`. – thomasb Jul 06 '16 at 15:45
  • You never ignored `src`... I don't see `src` anywhere in your `.gitignore` file, unless I am an ignoramus. – Tim Biegeleisen Jul 06 '16 at 15:47
  • I don't want to ignore `src/`, I want to ignore the `bin` and `obj` folders inside. It should be easy : http://stackoverflow.com/a/1470582/6776 ; additionnaly, you can see that I ignored the `.svn` folder but it still appears. – thomasb Jul 06 '16 at 15:49

1 Answers1

2

I have found an answer (but I'm not sure what's the source of the problem).

I have deleted the .gitignore file and recreated it using touch .gitignore.

I had copy/pasted the original file content from some website, I'm assuming it has something to do with the encoding or something like this.

thomasb
  • 5,816
  • 10
  • 57
  • 92