3

Finally going to give up and ask for help. Having some git (windows) issues. If I make changes to an existing file,I can add-commit-push as usual. However, if I create a new file, git does not track it at all. Regardless of folder or extension. I am quite certain this is not a gitignore issue.

I've tried cloning a fresh instance. Tried adding several file types. No errors, git just doesn't seem to be aware of new files.

Thanks for any assistance!

ScottVMeyers
  • 307
  • 3
  • 15
  • 4
    What happens when you `git add --all`? – cjaube Apr 05 '19 at 20:55
  • 1
    This is normal behavior. `git` does not track files unless you tell it to (which makes sense, because you don't want `git` attempting to track all your build artifacts, for example). You must explicitly `git add` those things you wish to track. – larsks Apr 05 '19 at 21:20
  • 2
    What do you mean, not aware of new files? They don't show in "untracked files" section of `git status`? Then it's a .gitignore issue. – Sergio Tulentsev Apr 05 '19 at 21:42
  • 3
    Possible duplicate of [Git commit -a "untracked files"?](https://stackoverflow.com/questions/8470547/git-commit-a-untracked-files) – SuperKogito Apr 05 '19 at 22:16
  • 1
    @SergioTulentsev no, they don't show in untracked files. I have looked in all the .gitignore files, and there is nothing out of the ordinary. I'm thinking some kind of config issue?? I really don't know. – ScottVMeyers Apr 08 '19 at 14:58
  • @cjaube i don't get any errors or anything. just nothing gets added. – ScottVMeyers Apr 08 '19 at 14:59
  • Have you looked in all `.gitignore` files with the command `it check-ignore -v -- a/new/file`? – VonC Apr 08 '19 at 15:26

1 Answers1

2

Make sure first those new files are not ignored:

cd /path/to/cloned/repo
git check-ignore -v -- a/new/file

If not, then a git status should list them, you can then add and commit said new files.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @SergioTulentsev Agreed: it was a typo. I was mentioning that command back in 2014 (https://stackoverflow.com/a/26908774/6309) – VonC Apr 08 '19 at 15:25
  • Thank you! Can you please help me interpret what returned? It says .gitignore:2:* – ScottVMeyers Apr 08 '19 at 16:13
  • @Sco That means the second line of your .gitignore file is ignoring everything – VonC Apr 08 '19 at 17:21