I work on my project in linux and I push my work to my git repo. I copied the project directory (including the .git dir) to my windows machine so I can work from there. Now when I execute git status
I get a ton of modified files, every single project file. So git thinks that each new file is a changed file, because I copy pasted it. Is there a way make git check, see that the files are the same and remove them from the list of changed files?
1 に答える
Copying git repository including working tree from Linux to Windows or vice versa is a bad idea, because it also copies the configuration and it's almost certainly wrong on the other platform. So the simple solution is to just don't do it and use clone (note, that clone works over samba, though it would be slow over non-local network).
The problem is probably because the git configuration (in .git/config
) copied from one system to another is inappropriate there or the default or system-wide configuration makes git expect the working tree look differently from what it does on the other system. I can think of 3 system-specific settings:
Newline conversion. Most likely your Windows git defaults to converting the newlines, so it expects the working directory to contain files with Windows CR/LF newlines, but it sees there files with Unix LF newlines. There is an old and a new way of setting this and the new one should not do it. And than it depends on whether you actually want to do the conversion; I found I almost never do.
Executable permission handling. There is no executable bit on Windows, so there is some option that tells the system to ignore the changes to it, but the repository copied from unix will have it set wrong.
The same applies to symlink handling.