3

I've got an interesting challenge.

Making my first steps with Git Version Control on Windows 8.1 I set up a folder, added files and then followed a tutorial. Simple. After some time I noticed that Windows Explorer didn't show me some of the files anymore (I think that was after using checkout but cannot confirm). Using git bash with the ls command, I still see them.

After a little research I can bring it to the point where I use following code:

touch gittest.txt

In git bash when I use

ls

it shows me the file.

In Windows Explorer however I don't see it.

I assume it is some sort of permission issue. I can't create a file in Windows Explorer since I work in an Apache htdocs-Folder and need Admin-Rights. So what I do is create "wintest.txt" somewhere else and move it to that folder.

In Explorer I see just that file, in git bash I see both:

ls -al

drwxr-xr-x 10 hogan Aminist 4096 Apr 3 15:00 .
drwxr-xr-x  7 hogan Aminist 4096 Apr 3 15:00 ..
-rw-r--r--  1 hogan Aminist    0 Apr 3 15:00 gittest.txt
-rw-r--r--  1 hogan Aminist    0 Apr 3 15:00 wintest.txt

The permissions seem alright here but I guess something is missing anyway. The file gittest.txt also is not hidden. I tried the switch in Explorer.

Another thing obvious to do is: I opened the Windows-Command Prompt with Admin-Rights, changed to the directory in question and entered the corresponding commands dir, dir/A:H...

No file "gittest.txt".

The git version is 1.9.5 for Windows Platform.

Interesting as well. I did this:

echo 'something' > overwrite.txt

(In Explorer I don't see it).

Created a file with the same name and content "done". Moved it to the Folder and there was no question "do you want to overwrite the file?".

Open the file from Explorer - it shows "done". Open it in git bash, it shows "something".

After opening and editing another file in Windows, I can see the changes in the bash with 'vim xyzFile.txt'. That means that I am definitively looking in the same folder.

When I open a file in bash with vim "xyzFile.txt" first and then saving it, it disappeared in Explorer.

Can anybody give me a hint where to search next and go on from this point? Please feel free to ask for more info.

hogan
  • 1,434
  • 1
  • 15
  • 32
  • Try `echo 'something' > gittest.txt` and see if it's now present in your explorer. Maybe the bash emulator avoids actually creating empty files. – ShellFish Apr 04 '15 at 00:56
  • You can also try `> gittest.txt`, which also creates an empty file but perhaps gitbash handles it differently. – ShellFish Apr 04 '15 at 01:04
  • Tried both. Gitbash tells me that the files are there. Even after closing and opening it again. No success in explorer. – hogan Apr 04 '15 at 05:00
  • Maybe try to run Windows file explorer as administrator? – ShellFish Apr 04 '15 at 05:19
  • I assume that opening the path in the Administrator Console does the same. There I have the same result. After using the command 'explorer.exe' from that Admin-Console and navigating to the path, it is the same result as well. No files. – hogan Apr 04 '15 at 05:25
  • I'm not sure it does, it's been a long time since I've been on Windows. In any case, if you have time try right click on file explorer -> properties -> compatibility -> run as admin. – ShellFish Apr 04 '15 at 05:30
  • Or maybe try `dir *gittest.txt /b/s` in your root directory. Perhaps the file is stored in some kind of tmp folder or something. – ShellFish Apr 04 '15 at 05:59
  • Just for testing, after looking at http://stackoverflow.com/a/29300360/6309, can you check if `git config core.protectNTFS` false changes anything? – VonC Apr 04 '15 at 08:03
  • Do you have 2 different workspaces, working in one and windows-exploring in the other? Try `git add *; git push` and checkout in a new dir. – Walter A Apr 04 '15 at 13:18
  • Thanks for the hints so far. None of them worked. It is some sort of User/Permission issue. After editing the permissions of the folder and giving the "Users"-group full control over the folder, I can create and see new files. The existing ones like "gittest.txt" stay hidden. Is it possible that the files are somehow stored in a git database in the background and commands like ls and vim access that information - and at the same time git fails to really create them physically due to permissions... and does not throw an exception? – hogan Apr 04 '15 at 19:17
  • Have you tried doing this in a directory where you've got full permissions? I can't think of a reason that it wouldn't work. – ChrisGPT was on strike Apr 06 '15 at 18:54
  • Hi Chris, I've tried successfully with full permissions on the same folder. That works when I first give the permissions and then let git bash create a file. If it is the other way around (create a file, then give full permission), the file is visible in git bash but never in Explorer/Command Prompt. – hogan Apr 07 '15 at 21:55
  • re: suggestions that git bash is doing something weird: git bash is simply bash compiled with mingw. Nothing in the question or comments actually invokes git at all. And even then, no git doesn't do anything weird with empty files. – Peter Cordes Apr 17 '15 at 20:44
  • To make sure your Windows Explorer window is browsing the same directory as your bash is `cd`ed to, you can `start .` to open an explorer at the current directory. Or, from explorer, "new shell here". – Peter Cordes Apr 17 '15 at 20:46
  • It sounds like you maybe had something other than allow-any permissions set up. I don't understand why you're seeing what you're seeing, but it's not git bash's fault. (Unless "proper" windows programs are supposed to do some steps that the mingw libraries don't?) I'd compare the file permissions / flags from a file created by something else, vs. a file created by a mingw program that you can't see. – Peter Cordes Apr 17 '15 at 20:50
  • Hi Peter, it's not really clear what you suggest. Anyway, I do a workaround on this. – hogan Apr 18 '15 at 23:32

1 Answers1

1

It seems like it is an permission problem. The situation did not get solved completely but there is a workaround which is fine for me at this time.

Solution: Change the folder permissions to full access for the user which runs the git bash statements.

The cause is that when installing Apache on a Windows System, the whole folder including htdocs has limited permissions set. Every time someone wants to create a file, they need Admin-Rights.

When starting git bash, it somehow does the changes in its own way but that doesn't have an effect upon the 'normal' windows user. To be clear: In git bash, the file creation (also if with content) works, you can see, open and edit the files as intended. In Windows that has no effect. (For now I guess Git creates its own database in the background and works with that one, not taking the real environment into account).

After granting full permission for the specific user(s) there is no problem anymore.

hogan
  • 1,434
  • 1
  • 15
  • 32