0

TL;DR summary

Weird files appeared. They show on git but not on disk. A list of possible programs causing that are listed.

  1. Why did they appear?
  2. How can I get rid of them now?

There is a weird \200 character I cannot type.


For the record: the solution that worked for me is the second answer of user VonC: https://stackoverflow.com/a/13250936/1255826


I already had to copy all the files and make a new Git repository, removing the .git folder from my project to try and fix this. git status claims there are modified files/folders with a very strange \200 character in their name, when actually I didn't add those.

To clarify, I cannot see any file with those names on my disk. I can only assume there is something weird going on in the .git folder. I've tried to see if there are any hidden files with that \200 part in their name. There aren't. (I even have the "show hidden files and folders" option enabled on my computer):

bad5e7f1e@DESKTOP-3KR49G0 ~/repos/algoritmi2016/laboratorio/lab5/es3/src
$ ls
es3.c  student

bad5e7f1e@DESKTOP-3KR49G0 ~/repos/algoritmi2016/laboratorio/lab5/es3/src
$ ls -ahf
.  ..  es3.c  student

bad5e7f1e@DESKTOP-3KR49G0 ~/repos/algoritmi2016/laboratorio/lab5/es3/src
$

screenshot

See my terminal log here to see exactly what I mean.

Note that git status didn't show these files, that were added a second later when I used the git add -A command. Then, after that, these "ghost" files are shown:

bad5e7f1e@DESKTOP-3KR49G0 ~/repos/algoritmi2016
$ git status
Sul branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   laboratorio/lab5/es3/Makefile
        modified:   laboratorio/lab5/es3/src/es3.c
        modified:   laboratorio/lab5/es3/src/student/student.c
        modified:   laboratorio/lab5/es3/src/student/student.h

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        laboratorio/lab5/es3/.gitignore

no changes added to commit (use "git add" and/or "git commit -a")

bad5e7f1e@DESKTOP-3KR49G0 ~/repos/algoritmi2016
$ git add -A

bad5e7f1e@DESKTOP-3KR49G0 ~/repos/algoritmi2016
$ git status
Sul branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   laboratorio/lab5/es3/.gitignore
        modified:   laboratorio/lab5/es3/Makefile
        modified:   laboratorio/lab5/es3/src/es3.c
        new file:   "laboratorio/lab5/es3/src\200student/student.c"
        new file:   "laboratorio/lab5/es3/src\200student/student.h"

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   laboratorio/lab5/es3/src/student/student.c
        modified:   laboratorio/lab5/es3/src/student/student.h
        deleted:    "laboratorio/lab5/es3/src\200student/student.c"
        deleted:    "laboratorio/lab5/es3/src\200student/student.h"


bad5e7f1e@DESKTOP-3KR49G0 ~/repos/algoritmi2016
$ 

I've already tried in the past to ignore this, and push the changes to github anyway, but then the same files/folders are shown in github, although when I click them I get an error page (404 or 500, I don't remember the error code).

Also, if I try to delete these with a del or rm command, it says the file doesn't exist. I don't even know if I can type the character that stands for the \200 escape code.

I might have to try and type that character when I use git rm <PATH/TO/FILE> instead of just trying to do del or rm, that do not work.

Why are these files/folder being created? Is it just a bug?

I'm working with a combination of these tools and programs: cygwin64, mingw64, gcc, make, splint, netbeans, atom (editor), git on Windows 10 x64. Is any of these the cause of the error?

My project folder is under C:\\Users\%USERNAME%\repos\algoritmi2016.

splint and git are installed both with and without cygwin. mingw64 is installed normally on Windows' cmd. gcc and make are installed under cygwin. Most of the time I am just using cygwin which points correctly to the cygwin version of splint, git, gcc and make.

I'm not using the atom shell commands, just the GUI editor.

I used Netbeans and atom only inside the ./laboratorio/lab5/es3 folder of my project. In that folder I have the Netbeans project files .project and nbproject.

On cygwin I have a symbolic link in my cygwin's home folder called repos pointing to my normal Window's %USERNAME%\repos folder. I use this link to navigate with cd quickly to my repos folder.

I tried to remove src\200student/ (is it even a folder?), using git git rm -rf ./*student --cached: it didn't match any file, unfortunately.

Is there something wrong in my setup causing this problem?

Community
  • 1
  • 1
Zorgatone
  • 4,176
  • 4
  • 30
  • 47

1 Answers1

1

These files get added to your commit when you issue the command git add -A. If you don't want them, just don't use the -A option to git add. Instead, I recommend only adding the files that you actually want to add to your git repository, one by one.

I don't know where they are actually coming from, however. My guess is that your IDE creates these files for metadata and / or backup while you have the files open. You probably don't have to worry about them, just don't add them into your repository. Next time you want to add somefile.cpp (and maybe it's header, too), just issue the command to add only that file:

git add somefile.cpp
git add somefile.h
mkrufky
  • 3,268
  • 2
  • 17
  • 37
  • please read my question again... I know `git add -A` adds all the new/modified files. But my issue here is that those files **do not exist** on my computer – Zorgatone Dec 07 '15 at 17:52
  • The only files that exist on my disk are those without the "\200" part in their name – Zorgatone Dec 07 '15 at 17:53
  • 1
    the files obviously DO exist on your computer if they are being added to git by `git add -A` ... Perhaps your question could be more specific. – mkrufky Dec 07 '15 at 17:55
  • Sorry I edited the question.. I didn't specify that there are not such files in the directory specified by git – Zorgatone Dec 07 '15 at 17:56
  • The files are there, but they are not files of a type that you are used to seeing. They are probably temporary files that *should* be deleted when you close your IDE. The fact that they show up in your git commits is because you are specifying the `-A` option to `git add`, which is clearly not right for your situation. – mkrufky Dec 07 '15 at 17:58
  • When I did the `git` command all the programs (instead `cygwin` obviously) where closed. Also I have `show hidden files` enabled, and even tried `ls -ahf` with `cygwin`.. Still cannot see any files with the "\200" part – Zorgatone Dec 07 '15 at 17:59
  • You asked "why are they in my commit?" - you have your answer. You may want to ask a new question "where did these files come from" having nothing to do with git. – mkrufky Dec 07 '15 at 18:01
  • Well, actually I asked `Why are these files/folder being created? Is it just a bug?`. And the title: `Git weird file and folders with “\200” weird character in name`. Anyway... updated question with screenshots and logs. How do I get rid of this files? I'll change the title too now.. Just a sec.. – Zorgatone Dec 07 '15 at 18:03
  • They're most definitely not being created by `git` itself. – mkrufky Dec 07 '15 at 18:05
  • shall I ask again on SuperUser? – Zorgatone Dec 07 '15 at 18:05
  • By the way, that's why I asked if it was `git`, `cygwin` or any of the other tools I listed – Zorgatone Dec 07 '15 at 18:06
  • 1
    there's nothing wrong with asking this on stackoverflow. I'm just telling you that `git` is not causing the files to appear. – mkrufky Dec 07 '15 at 18:06
  • Ok, then. Good to know, at least 1 less program that could cause that. But still one of the others (`cygwin`, or any editor) is doing this.. – Zorgatone Dec 07 '15 at 18:07
  • Can I exclude that there could be a bug with `git` on `cygwin` specifically? – Zorgatone Dec 07 '15 at 18:07
  • I would do an experiment in a clean tree. Open your editors, make some changes... Look to see if the files are created. DO NOT check them into git. Close the editor & all programs, look to see if the files are gone. If not, then reboot and check again. These are just temporary files caused by something that you are doing and will likely delete themselves. I'd also recommend some research into Windows filesystems. There are some characteristics of some filesystems to make temporary files and shadow copies. I don't know if thats what's happening here, but it's worth reading about. – mkrufky Dec 07 '15 at 18:10
  • 1
    definitely not even related to `git`. yes, you can exclude that possibility. – mkrufky Dec 07 '15 at 18:11
  • I'll try that. Can we talk more in chat, instead of using comments? – Zorgatone Dec 07 '15 at 18:14
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/97218/discussion-between-zorgatone-and-mkrufky). – Zorgatone Dec 07 '15 at 18:14
  • The part I still cannot understand is why the `git status` didn't show these files, that were later added when I used `git add -A` a second later – Zorgatone Dec 07 '15 at 18:17
  • nvm, found a similar question and solved. Thanks again @mkrufky – Zorgatone Dec 07 '15 at 19:22
  • my apologies. I went out to lunch just when you asked to meet in chat. – mkrufky Dec 07 '15 at 19:34
  • np.. Thanks anyway for answering – Zorgatone Dec 07 '15 at 19:49