Files showing as modified directly after git clone

I'm having an issue with a repository at the moment, and though my git-fu is usually good, I can't seem to solve this issue.

When I clone this repository, then cd into the repo, git-status shows several files as changed. Note: I haven't opened the repo in any editor or anything.

I tried following this guide: http://help.github.com/dealing-with-lineendings/ but this didn't help at all with my issue.

I have tried git checkout -- . many times but it seems not to do anything.

Any help/ideas would be greatly appreciated

Update 1: I'm on a mac, and there are no submodules in the repo itself.

Update 2: the filesystem is "Journaled HFS+" filesystem on the mac, and is not case-sensitive. The files are one-line and about 79K each (yes, you heard right) so looking at git diff isn't particularly helpful. I have heard about doing git config --global core.trustctime false which might help, which i will try when i get back to the computer with the repo on it.

Update 3: changed details of filesystem with facts! and, I tried the git config --global core.trustctime false trick which didn't work very well.


I had the same problem on the Mac after cloning a repo, it would assume all files have been changed.

After running git config --global core.autocrlf input it was still marking all files as changed. After looking for a fix I came across .gitattributes file in the home directory which had the following.

* text=auto

I commented it out and any other cloned repositories from now on are working fine. Hope this helps anyone out there.


I got it. All the other developers are on ubuntu (i think), and thus have case-sensitive file systems. I, however, do not (as I'm on a mac). Indeed all the files had lowercase twins when I took a look at them using git ls-tree HEAD <path> .

I'll get one of them to sort it out.


git config core.fileMode false

solved this problem in my case

https://www.kernel.org/pub/software/scm/git/docs/v1.7.10.1/git-config.html

TL;DR;

core.fileMode

If false, the executable bit differences between the index and the working tree are ignored; useful on broken filesystems like FAT. See git-update-index(1).

The default is true, except git-clone(1) or git-init(1) will probe and set core.fileMode false if appropriate when the repository is created.

链接地址: http://www.djcxy.com/p/30010.html

上一篇: Windows上的Git文件权限

下一篇: git clone后直接显示修改的文件