26

I am having issues with my git on a windows machine. I always have some git files that are modified in every repo, the files that show as modified are same.

If I clone a new repo and use tortoisegit to commit I see some files as modified, even if I never touched a single file in the repo. "gitstatus" doesnt show any modifications though

Any help is appreciated. Thanks

pbathala
  • 1,390
  • 2
  • 18
  • 39
  • [Line endings](https://help.github.com/articles/dealing-with-line-endings) are probably your issue. –  Apr 01 '13 at 21:19
  • This is probably a bug in tortoisegit, similar to the bug in GitHub for Windows: http://stackoverflow.com/questions/15717077/line-endings-with-cygwin-and-github-for-windows/15719108# – Edward Thomson Apr 01 '13 at 22:00

6 Answers6

25

Check if the changes are merely changes in file permissions. This was the reason in my case, both TortoiseGit and Git Extensions displayed unmodified files.

Use git config core.fileMode false to ignore chmod differences (or directly edit the .git/config file).

You may also want to set this as the global config with git config --global core.filemode false.

Community
  • 1
  • 1
Juuso Ohtonen
  • 8,826
  • 9
  • 65
  • 98
  • 6
    On Windows this has no effect except if you're using git from Cygwin. – rustyx Dec 16 '15 at 16:04
  • does not work on windows :) the only thing worked is just open Tortoise Git Settings, click on general and then re run first wizard then click next and finally it would ask you to give git.exe path then if it is inside the cygwin folder installation then change it to git.exe which you installed or any other tool like gitbash will also have git.exe – NeverGiveUp161 Sep 25 '19 at 15:10
15

It's line endings issue. Set this on your windows machine:

git config --global core.autocrlf true
Ruslan Osipov
  • 5,655
  • 4
  • 29
  • 44
  • Also, the file will appear changed whereas even the line endings will appear exactly the same. That's because Git compares the version that is about to be committed, but presents to you the local versions. You'll have to commit the file once after changing the `autocrlf` setting, and for the future make sure everyone on the team has this setting set correctly. – rustyx Dec 16 '15 at 16:13
  • does not work on windows :) the only thing worked is just open Tortoise Git Settings, click on general and then re run first wizard then click next and finally it would ask you to give git.exe path then if it is inside the cygwin folder installation then change it to git.exe which you installed or any other tool like gitbash will also have git.exe – NeverGiveUp161 Sep 25 '19 at 15:10
10

None of the proposed fixes worked for me. However, I had Cygwin installed and TortoiseGit picked up its path when installed. I solved it by installing the official Git package and changed the path in TortoiseGit.

BoneGoat
  • 554
  • 5
  • 9
  • 1
    I know that this is old, but it was the only one that helped me. You will have this issue again, every-time you upgrade TurtoiseGit, unless (I assume) you have your PATH setup correctly, with the GIT path before the Cygwin path. – lionscribe Nov 24 '16 at 21:30
7

If using TortoiseGit with Cygwin git (not officially supported), several extra setup steps should be done:

  1. Select the [CYGWIN-INSTALL-PATH]\bin-folder as git.exe folder.

  2. Configure the HOME environment variable in Windows, so that Cygwin and TortoiseGit are using the same home directory and global git-config. Use the normal Windows notation here (e.g., C:\Users\USERNAME). By default, TortoiseGit uses the Windows home directory which is normally located under c:\Users and Cygwin uses its own home directories which are located under [CYGWIN-INSTALL-PATH]\home.

  3. Configure AutoCrLf, this is necessary as TortoiseGit and Cygwin Git have different defaults. The default in Cygwin Git is true.

  4. Go to TortoiseGit the section called Advanced Settings and set CygwinHack to true in order to activate cygwin workarounds.

  5. Reboot.

Step #4 is crucial and resolved the problem for me.

Reference (see Cygwin Git section): https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Gene Pavlovsky
  • 1,515
  • 17
  • 14
2

Just posting it as a answer here because it might help someone else.

If you have Cygwin and Tortoise Git installed, then it will simply show many files when you try to merge the code with 0 lines added and 0 lines removed which is kind of irritating.

I tried adding the above options in git config but it did not help.

You can simply right click on any folder go to

Tortoise Settings -> General -> Rerun First Time Wizard

Now here you can change the path to git.exe by pointing to other Git.exe or if you have Gitbash installed you can point to its git.exe also. Just make sure the already existing path should be something from Cygwin/bin/git.exe which should be updated to other git.exe.

NeverGiveUp161
  • 824
  • 12
  • 33
1

I just had this problem and for me the fix turned out to be quite simple.

Ensure there are no git processes currently running and then delete .git\index.lock.

After this the modified state of my files were handled correctly.

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
GlacialSpoon
  • 277
  • 3
  • 13