Spark
Spark

Reputation: 308

.git directory does not appear as a directory on Windows

I cannot cd into some of my .git directories on Windows.

Some of my repositories are fine. The .git directory appears as you would expect in them:
drwxrwx---+ 1 grandps Domain Users 0 Oct 11 15:42 .git I can cd into the .git directory, and ls it to see its contents.

In other repos, the .git directory shows up as a regular file. I can't cd into it or ls to see its contents. If I try to open it in Windows Explorer, I can't - Windows thinks it's a file, too.
-rwxrwx---+ 1 grandps Domain Users 68 Jun 22 12:22 .git

The repo still works as a git repository. I can run git commands just fine. I just can't get into the .git folder.

I have tried both Git Bash (MinGW64) and Cygwin. Both give the same results.

Any ideas how this could have happened, and how I can fix it?

Upvotes: 0

Views: 318

Answers (1)

Jan Tvrdík
Jan Tvrdík

Reputation: 395

According to documentation, the file should contain path to the actual repository directory.

Also you can have a plain text file .git at the root of your working tree, containing gitdir: to point at the real directory that has the repository. This mechanism is often used for a working tree of a submodule checkout, to allow you in the containing superproject to git checkout a branch that does not have the submodule

source: https://git-scm.com/docs/gitrepository-layout

Upvotes: 4

Related Questions