0

My repository consists of two folders client and server. In server I have few folders which were automatically generated by Codeblocks IDE like bin and obj. I dont want to store them in my repository, so I decided to add .gitignore. I tried everything:

# folders **/bin/ **bin/ **/bin **bin bin /bin bin/ /bin/ server/bin /server/bin server/bin/ server/bin 

And still after pull and making git status I can see that bin folder will be pushed. What am I doing wrong?

11
  • How do the files appear in git status? Commented Jan 16, 2018 at 16:20
  • new file: server/bin/Debug/chat server new file: server/obj/Debug/chat.o Commented Jan 16, 2018 at 16:23
  • 1
    Possible duplicate of How to make Git "forget" about a file that was tracked but is now in .gitignore? Commented Jan 16, 2018 at 16:23
  • Even if I use git rm -r --cached . and git add . the bin folder is still being tracked. Commented Jan 16, 2018 at 17:21
  • @destroyer - Only a dup (of that quesiton) if the person asking realizes that the file was already tracked and that they're wanting git to "forget" the file. "Same answer" is not the same thing as "dup". Commented Jan 16, 2018 at 17:22

1 Answer 1

1

In comments, you show that each file is listed as a "new file". You don't specify whether these show as "changes to be committed" or "untracked files"; but in the case of untracked files, if no files in a directory are tracked then only the directory (not the individual files) would be listed by default.

So it seems the problem is that files in these directories are in the index, which means git can't ignore them. You could remove them from the index

git rm -r --cached server/bin git rm -r --cached server/obj 
Sign up to request clarification or add additional context in comments.

2 Comments

It says fatal: pathspec 'server/bin' did not match any files. What I noticed is when i change branch to master it is not tracking bin folder. After changing to my second branch it is tracking that folder.
Now, in .gitignore I have *.o. I added new file t.o and when I use git status I can see, that this file is set as untracked. I think it should ignore this file. Ehh...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.