Search code examples
gitbashwindows-8.1file-permissionsgit-bash

How can I make files which were created with git bash (touch file) visible in Windows 8.1?


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.


Solution

  • 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.