You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some repos created in windows. When I run git status, it shows all files in the branch as up to date and nothing to commit except for a couple of untracked files. When I run git status, in bash on Ubuntu on Windows, it shows what seems to be all of my files as modified and not staged for commit.
Reacted by Stefan Schneider, Edson Guimarães, Elias Fank, Kamil Blachura, Ambar Mutha, strarsis, WangWeigao, Nils Waldraff, Tulsi Prasad, Divyanshu Kalra and 52 more
Could you check if your git for windows version and git version inside bash are similar? It's possible that there is an incompatibility between the way the versions keep track of changes.
Reacted by Ali Z. Emili, Stefan Schneider, Jean León, Luiz Machado, Ankit Vashisht, Samad Ibrahim and isees
Reacted by Philip Rego, Kfir Ezekiel and Alexander Liu
Ben Hillis (@benhillis) you might be right about that. In windows I have git version 2.7.2 installed, and in ubuntu on windows, I have version 2.8.1 installed. I guess this is not a big deal since I knew all my repos were up to date and I could do a git reset in bash on ubuntu on windows.
This could have something to do with WSL reporting the permissions of all files on the Windows filesystem as being 777. Git then regards all files as changed because their permissions are different.
Try changing the Git configuration so that permission changes are ignored:
# For the current repository
git config core.filemode false
# Globally
git config --global core.filemode false
Reacted by Chintan Zaveri, Gabriel Rota, Takuma Ishikawa, Zack Stone, Robert K. Bell, Onur Guvenc, Christopher Mathis, Vagios Vlachos, dozyc, Jeremy Fortune and 483 more
Reacted by Chris Bier, John Buxton, nogo0d, Serhii Khalymon, Ahmed Shehatah, Matt Gabriel, Vincent Semrau, JKatzwinkel, Ashutosh Hathidara, Randy Wijnants and 15 more
Reacted by Jalaj, daisy-enolpe, Garth Baker, Oliver Spryn, thonghh-vnlab, Sanket Wagh, 王沛茗 and Edwin J. Munguia
Reacted by Bakasura, larfis, Cookie, Felipe Medeiros, Passerby, Meysam Alipour, autodonncha, François-Xavier Lemire, Serhii Khalymon, Nananana97 and 46 more
Reacted by Cookie, Rohland, elitechweb, Felipe Medeiros, Passerby, Kylie X, Wahyu Ibnu Dzakaria, Lucie JOSEPH, Meysam Alipour, Sadjad Tehranchi and 82 more
Reacted by Alex, peter-hartmann-emrsn, Rshad Zhran, Valter Barros, EugeneGpil, Manjot Singh, Oliver, noumena ashitaka, Luís Tavares, Ahmet Melek and 19 more
Reacted by Alex, Valter Barros, Sidharth Shambu, Jalaj, daisy-enolpe, Garth Baker, Oliver Spryn, ajayprajapati1, thonghh-vnlab, Juan Pinheiro and 3 more
It may be line endings,WSL thinks it is linux so it will use LF as the line endings.
You can set git to only use CRLF line endings with:
git config --global core.autocrlf true
Reacted by Noext, John McVeigh, Santiago Camargo Rodríguez, Matt Cole, Gaurav Parmar, TF, coblan, Mayank Gureja, Thomas Dyar, AbderrahimDz24 and 812 more
Reacted by John Buxton, Matt Gabriel, Alexander Lockshyn, Sudipto Chandra, Hasham, Faith Morante, kedbirhan, Narcis Bugeag, Binar Web, Vernon Grant and 2 more
Reacted by Wahyu Ibnu Dzakaria, WofWca, Pedro Valentim Silva Leite, Guillermo, Sudipto Chandra, Hasham, Matthew, Edson Guimarães, he44, meluskyc and 17 more
Reacted by Nicolás Silva, Artem Prudnikov, Fredrick Dahlin, Roberts Slisans, Ginés Hidalgo, ClearCompress, afanucchi, Giovanni Cerretani, Benedetto Polimeni, aejay-rs and 78 more
Reacted by Giovanni Cerretani, Kirill Birger, aejay-rs, Max Fraire, Wahyu Ibnu Dzakaria, Matan Kotler-Berkowitz, Olivier Guimbal, Himanshu Ragtah, Daniel Morgenstern, Shrikanth and 118 more
Reacted by Edward, Hasham, Vincent LANDAIS, Matthew, Joe, Edson Guimarães, Anna Ivakhnik, he44, Kurtis Streutker, Faith Morante and 31 more
Reacted by Marigold VanEseltine, Pedro Valentim Silva Leite, Sudipto Chandra, Hasham, Matthew, Edson Guimarães, Ben Boydens, Narcis Bugeag, Alexandre, Francisco Ramón Sánchez Favela and 6 more
Tried git config --global core.autocrlf true and it looked to clean up this issue.
Marking this one as fixes for now. I'll close it out as a cleanup in about a week if no additional comments / discussions.
Reacted by Ophir Yoktan, cdanyl, Lega, Ghasan (غسان), Jesper Thiesen, Eric Kapilik, Michael Neth, Jonathan Gardner, Gaspard Rosay, cxfksword and 127 more
Reacted by Matt Gabriel and zheng
Reacted by Adriano Kerber, Bart de Bever, neechee, Alfonsina Lizardo, daisy-enolpe, Jose Antonio Felix and Abdul Mannan
Reacted by Kalind Karia, Adriano Kerber, An Yan, Bart de Bever, Matt Tysor, daisy-enolpe, Alexandros Pappas, Jose Antonio Felix , Abdul Mannan, Udit Arora and 1 more
Reacted by Adriano Kerber, Aaditya Chokshi, Joe, MD. SHAHIDUL ISLAM, daisy-enolpe, Jose Antonio Felix and Abdul Mannan
Just a follow-up to this, since I had the same issue and this thread helped me:
The issue was only fixed when I changed the configuration for bothcore.autocrlf and core.filemode.
That is (for the local repository), git config core.autocrlf true git config core.filemode false
If I change either of them back to their original setting, every file in the repository is listed as modified.
On another note, unless you're certain that you will only be cloning repositories on git for Windows, I don't recommend changing the --global setting.
Reacted by Robert K. Bell, bW8kZmFt, Asterios Stergioudis, Joshua Gray, Artem Prudnikov, David Hockenberry, Chris Holdgraf, Søren Nguyen Boisen, Alipio , Krunal Panchal and 148 more
Reacted by Adrian Riyadi, Winnie A. Damayo, Kelvin Zhang, rtman, Almenon, Jonathan S, Mohammed Ibrahim, Ligengxin, slackermorris and Sudhar287
Reacted by Winnie A. Damayo, Kelvin Zhang, Sheshagiri Anvekar, rtman, Almenon, Jonathan S, Levi Lansing, Jason, Mohammed Ibrahim, Ligengxin and 8 more
Reacted by Alipio , Krunal Panchal, Winnie A. Damayo, Kelvin Zhang, rtman, Almenon, Nicklas Pouey-Winger, Jonathan S, Oare Arene, Julimbob and 16 more
Reacted by Rishi Rawat, Ligengxin, Dan, slackermorris, Felipe Estevanatto, Sudhar287, Jamaluddin Rumi and Danny Reed
I came across this today, setting both autocrlf=true & filemode=false both globally and in the repo config doesn't work. git status still shows all files as changed.
git version 2.7.4
UbuntuOnWindows version 1604.2017.922.0
Ubuntu release is Ubuntu 16.04.3 LTS
Repository was originally cloned with git-for-windows. where autocrlf is also true globally.
Actual files on disk have CRLF.
This is a problem. This means that switching platforms invalidates entries in the index cache. This will trigger a re-stat of the invalid files, which will be slow. (In one of my cases, excruciatingly so.)
But I know what you're thinking...an invalid cache should just be slow, not produce incorrect results. Yes I agree, but I still suspect this is part of the problem.
History: I was tracking down a similar problem in git lfs (you can search for it and you'll see it numerous times) which has to do with what happens when a filter is changed (or the list of file types it acts upon gets changed). [Turns out this not specific to git lfs and can happen with any filter.]
In that situation, this mattered. I was seeing changes on the platform which had the foreign index file. The files were in fact out-of-date. But on the other platform, this fact was hidden by the index matching, as the direct comparison was being skipped in that case.
Hope this helps. Even if not, I hope somebody reading this might know more about this index-entry time difference and identify it as a bug or a limitation.
Later.
Reacted by Esa Koskinen, Sz., Andrew Sears, Brandon White and Gaëtan Harter
I had this problem too. Sharing my problem and solution...
Environment
Windows 7
VS Code 1.22.1
Problem
I had created a repo using cygwin git version 2.15.1 (I'm using cygwin because zsh is cool, ok?).
Unfortunately, VS Code was picking up git for windows (git version 2.15.0.windows.1) which was reporting all files as modified.
I tried configuring VS Code to pick up cygwin git instead, but they will not play nicely together (surprise surprise 🙄 ): microsoft/vscode#7998
For me, all suggestions that this was caused by line endings were a red herring.
Solution
The solution was to modify .git/config in the repo to add the following option:
[core]
filemode = false
This explanation was : helpful
From now on, I'll configure my cygwin environment to use the same "git for windows" that VS code is using, since VS code is forcing me to go down that route.
Epitaph
Trying to get open source tools to work on Windows has always been a PITA. ~20 years of this nonsense, will it ever end ?
Reacted by Jonatan, Emerick Rogul, Thierry Bernier, FPsamuraiG, Martyn, Awesomeoman, Markus Ende, Hawkeye Parker, Aaron Jones, Ingwersaft and 8 more
Reacted by Markus Ende, Aaron Jones, Ilya Viaznin and Alexander Quessy
Git comes with Git Bash, which avoids this problem. It also has handy tab-completion, which you don't get in powershell.
Reacted by WSLUser, Esa Koskinen, Niels-Oliver Walkowski, Niklas Lillqvist, eddiestudies, Fabian Letsch, muyinliu, Jimmy Engelbrecht, Tom, Sandro Winkler and 7 more
If you are trying to trigger the git installation in windows from within WSL, then just use git.exe instead of just git. No additional git configuration needed
Reacted by Gaëtan Harter, amaajemyfren, Yashas Ip and Juan Fernando Martinez Hidalgo
If you are trying to trigger the git installation in windows from within WSL, then just use git.exe instead of just git. No additional git configuration needed
I am trying to look at a repository with git lfs files on the windows filesystem from WSL.
With all the configurations said in this page the files are still shown as modified.
Using git.exe for listing diff in wsl does not report the lfs tracked files as modified so helps workaround the issue mentioned by barkofdelight
See the official documentation for the correct way to resolve line endings conflicts using the .gitattributes file in Git 2.10+. This is the preferred method over setting core.autocrlf true because it goes into source control and resolves the issue for everyone using the repo whereas the git config method resolves the issue only for you.
See the official documentation for the correct way to resolve line endings conflicts using the .gitattributes file in Git 2.10+. This is the preferred method over setting core.autocrlf true because it goes into source control and resolves the issue for everyone using the repo whereas the git config method resolves the issue only for you.
For me it had something to do with source control inside VScode. Instead of git add . inside powershell I managed the commit inside of VS code. This actually removed the list of all hundreds of files for me.
This could have something to do with WSL reporting the permissions of all files on the Windows filesystem as being 777. Git then regards all files as changed because their permissions are different.
Try changing the Git configuration so that permission changes are ignored:
# For the current repository
git config core.filemode false
# Globally
git config --global core.filemode false
After surfing internet for 30 min, I'm finally able to get it right all thanks to u Sir
@mattdamon108 yeah, unfortunately, git overrides this setting every time you clone a repo for whatever reason the global setting does nothing unless you remove it locally.
This is what I had to do. git config --global core.fileMode false did nothing, while git config core.fileMode false fixed the issue.
Just a follow-up to this, since I had the same issue and this thread helped me:
The issue was only fixed when I changed the configuration for bothcore.autocrlf and core.filemode. That is (for the local repository), git config core.autocrlf truegit config core.filemode false
If I change either of them back to their original setting, every file in the repository is listed as modified. On another note, unless you're certain that you will only be cloning repositories on git for Windows, I don't recommend changing the --global setting.
This did it for me (working in Windows with a repo developed in Linux), and only requires local change to settings.
This could have something to do with WSL reporting the permissions of all files on the Windows filesystem as being 777. Git then regards all files as changed because their permissions are different.
Try changing the Git configuration so that permission changes are ignored:
# For the current repository
git config core.filemode false
# Globally
git config --global core.filemode false
Denis Washington (@denisw) The first command fixed it for me, thanks, followed by a git reset. The file permissions had indeed been changed by Windows when I copied and pasted a repository. (Lazy, I know, but wanted to avoid re-cloning!)
Activity
benhillis commentedon Apr 14, 2016
Could you check if your git for windows version and git version inside bash are similar? It's possible that there is an incompatibility between the way the versions keep track of changes.
charlescho commentedon Apr 14, 2016
Ben Hillis (@benhillis) you might be right about that. In windows I have git version 2.7.2 installed, and in ubuntu on windows, I have version 2.8.1 installed. I guess this is not a big deal since I knew all my repos were up to date and I could do a
git resetin bash on ubuntu on windows.benhillis commentedon Apr 14, 2016
I'm speculating :)
I'll try this as well and see what I find.
denisw commentedon Apr 14, 2016
This could have something to do with WSL reporting the permissions of all files on the Windows filesystem as being 777. Git then regards all files as changed because their permissions are different.
Try changing the Git configuration so that permission changes are ignored:
nestalk commentedon Apr 14, 2016
It may be line endings,WSL thinks it is linux so it will use LF as the line endings.
You can set git to only use CRLF line endings with:
mjoppich commentedon Apr 16, 2016
I also think this might be line endings.
I have the very same problem between the "git bash" (mingw) and cygwin ...
russalex commentedon Apr 27, 2016
Older thread so wanted to clean up.
Tried
git config --global core.autocrlf trueand it looked to clean up this issue.Marking this one as fixes for now. I'll close it out as a cleanup in about a week if no additional comments / discussions.
asher-dev commentedon Mar 20, 2017
Just a follow-up to this, since I had the same issue and this thread helped me:
The issue was only fixed when I changed the configuration for both
core.autocrlfandcore.filemode.That is (for the local repository),
git config core.autocrlf truegit config core.filemode falseIf I change either of them back to their original setting, every file in the repository is listed as
modified.On another note, unless you're certain that you will only be cloning repositories on git for Windows, I don't recommend changing the
--globalsetting.tdaniely commentedon Jan 16, 2018
I came across this today, setting both autocrlf=true & filemode=false both globally and in the repo config doesn't work. git status still shows all files as changed.
git version 2.7.4
UbuntuOnWindows version 1604.2017.922.0
Ubuntu release is Ubuntu 16.04.3 LTS
Repository was originally cloned with git-for-windows. where autocrlf is also true globally.
Actual files on disk have CRLF.
barkofdelight commentedon Feb 1, 2018
Hi there.
I am experiencing a similar problem, which might be part of your problem.
git ls-fileshas a--debugflag which sheds some light on the matter.I make repository with a file and in the ubuntu bash script I issue that command, I get this output:
test1ctime: 1517447477:356798400mtime: 1517447477:356798400dev: 12 ino: 212494uid: 0 gid: 0size: 14 flags: 0I run the same command on the Windows side (also using bash, but not via Ubuntu) and I get the same results. So far so good.
But...after running
git statuson the Windows side, the numbers change!:test1ctime: 1517447474:553598100mtime: 1517447477:356798400dev: 0 ino: 0uid: 0 gid: 0size: 14 flags: 0This is a problem. This means that switching platforms invalidates entries in the index cache. This will trigger a re-stat of the invalid files, which will be slow. (In one of my cases, excruciatingly so.)
But I know what you're thinking...an invalid cache should just be slow, not produce incorrect results. Yes I agree, but I still suspect this is part of the problem.
History: I was tracking down a similar problem in
git lfs(you can search for it and you'll see it numerous times) which has to do with what happens when a filter is changed (or the list of file types it acts upon gets changed). [Turns out this not specific togit lfsand can happen with any filter.]In that situation, this mattered. I was seeing changes on the platform which had the foreign index file. The files were in fact out-of-date. But on the other platform, this fact was hidden by the index matching, as the direct comparison was being skipped in that case.
Hope this helps. Even if not, I hope somebody reading this might know more about this index-entry time difference and identify it as a bug or a limitation.
Later.
lqueryvg commentedon Apr 8, 2018
I had this problem too. Sharing my problem and solution...
Environment
Problem
I had created a repo using cygwin
git version 2.15.1(I'm using cygwin becausezshis cool, ok?).Unfortunately, VS Code was picking up git for windows (
git version 2.15.0.windows.1) which was reporting all files as modified.I tried configuring VS Code to pick up cygwin git instead, but they will not play nicely together (surprise surprise 🙄 ):
microsoft/vscode#7998
For me, all suggestions that this was caused by line endings were a red herring.
Solution
The solution was to modify
.git/configin the repo to add the following option:This explanation was : helpful
From now on, I'll configure my cygwin environment to use the same "git for windows" that VS code is using, since VS code is forcing me to go down that route.
Epitaph
Trying to get open source tools to work on Windows has always been a PITA. ~20 years of this nonsense, will it ever end ?
syntholly commentedon Oct 17, 2018
Just a minor update on an old issue.
I work on a *nix box through SSH from my MacOS system. Git is updated through Homebrew and there is a mismatch on that version with the box's.
To that end, I discovered that as long as both settings match, you'll find the issue resolves itself.
For MacOS users, the following helped (on both the *nix box and my desktop):
git config --global core.autocrlf false && git config --global core.filemode trueluigip commentedon Oct 17, 2018
Git comes with Git Bash, which avoids this problem. It also has handy tab-completion, which you don't get in powershell.
11 remaining items
heryudi commentedon Jun 8, 2020
Works for me as well. Thanks!
Lolkekzor commentedon Jun 15, 2020
Fix worked, thanks.
harindaka commentedon Jun 18, 2020
If you are trying to trigger the git installation in windows from within WSL, then just use
git.exeinstead of justgit. No additional git configuration neededcladmi commentedon Jun 24, 2020
I am trying to look at a repository with
git lfsfiles on the windows filesystem from WSL.With all the configurations said in this page the files are still shown as modified.
Using
git.exefor listing diff inwsldoes not report the lfs tracked files as modified so helps workaround the issue mentioned by barkofdelightChiramisudo commentedon Jun 27, 2020
See the official documentation for the correct way to resolve line endings conflicts using the
.gitattributesfile in Git 2.10+. This is the preferred method over settingcore.autocrlf truebecause it goes into source control and resolves the issue for everyone using the repo whereas thegit configmethod resolves the issue only for you.Sources:
Get started using Git on Windows Subsystem for Linux / Git line endings | Microsoft Docs
Resolving Git line ending issues in containers (resulting in many modified files) | VS Code
Reference Page:
.gitattributes| git-scm.comreceter commentedon Oct 27, 2020
Thanks, this is by far the best solution for the line ending issue.
kantmichel commentedon Dec 22, 2020
For me it had something to do with source control inside VScode. Instead of git add . inside powershell I managed the commit inside of VS code. This actually removed the list of all hundreds of files for me.
cyancity commentedon Jan 22, 2021
same situation here, problem solved
Prakash-seh commentedon Jul 2, 2021
After surfing internet for 30 min, I'm finally able to get it right all thanks to u Sir
benfulton commentedon Apr 7, 2022
This is what I had to do.
git config --global core.fileMode falsedid nothing, whilegit config core.fileMode falsefixed the issue.paddy-r commentedon Dec 20, 2022
This did it for me (working in Windows with a repo developed in Linux), and only requires local change to settings.
paddy-r commentedon Mar 22, 2023
Denis Washington (@denisw) The first command fixed it for me, thanks, followed by a
git reset. The file permissions had indeed been changed by Windows when I copied and pasted a repository. (Lazy, I know, but wanted to avoid re-cloning!)fistvan commentedon Dec 5, 2023
If the above config settings don't seem to work, you can always check the full configuration parameter list with
git config --listsadmananik commentedon Dec 12, 2023
In my case, this was happening due to file permissions, so I had to run the following command for that file:
git update-index <file>Clumsy-Coder commentedon Mar 6, 2024
I found that running command
git update-index --assume-unchanged $(git ls-files | tr '\n' ' ')helps.obtained from