Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove files saying "old mode 100755 new mode 100644" from unstaged changes in Git?

Tags:

git

git-gui

For some reason, when I initially did a pull from the repository for a git project of mine, I got a ton of files in my working copy that have no discernible changes made to them, but keep showing up in my unstaged changes area.

I'm using Git Gui on Windows xp, and when I go to look at the file to see what has changed. All I see is:

old mode 100755  
new mode 100644  

Does anyone know what this means?

How can I get these files out of my list of unstaged changes? (Very annoying to have to go through 100's of files, just to pick out files I've recently edited and want to commit).

like image 944
concept47 Avatar asked Aug 10 '09 22:08

concept47


People also ask

What does 100755 mean in git?

This usually happens when the repo is cloned between Windows and Linux/Unix machines. Just tell git to ignore filemode change. Here are several ways to do so: Config ONLY for current repo: git config core.filemode false. Config globally: git config --global core.filemode false.

What is mode change in git?

It means that the file mode changed from 755 to 644, but the contents were not altered. git diff is exactly what you are looking for - it shows the changes from unstaged files to the last commit. git diff --cached is for staged files. Follow this answer to receive notifications.

What does 100644 mean?

Create Mode: - Tells about permissions given to that file, i.e., File permissions. Here, 100644 means the file is a normal file.

Does git track file permissions?

false : git does not track it.


4 Answers

That looks like unix file permissions modes to me (755=rwxr-xr-x, 644=rw-r--r--) - the old mode included the +x (executable) flag, the new mode doesn't.

This msysgit issue's replies suggests setting core.filemode to false in order to get rid of the issue:

git config core.filemode false
like image 195
Amber Avatar answered Oct 27 '22 10:10

Amber


Setting core.filemode to false does work, but make sure the settings in ~/.gitconfig aren't being overridden by those in .git/config.

like image 33
NovelX Avatar answered Oct 27 '22 11:10

NovelX


This usually happens when the repo is cloned between Windows and Linux/Unix machines.

Just tell git to ignore filemode change. Here are several ways to do so:

  1. Config ONLY for current repo:

     git config core.filemode false
    
  2. Config globally:

     git config --global core.filemode false
    
  3. Add in ~/.gitconfig:

     [core]
          filemode = false
    

Just select one of them.

like image 61
K. Symbol Avatar answered Oct 27 '22 11:10

K. Symbol


I've encountered this problem when copying a git repo with working files from an old hard drive a couple times. The problem stems from the fact that the owner and permissions changed from the old drive/machine to the new one. The long and short of it is, run the following commands to straighten things out (thanks to this superuser answer):

sudo chmod -R -x . # remove the executable bit from all files

The former command will actually resolve the differences that git diff reported, but will revoke your ability to list the directories, so ls ./ fails with ls: .: Permission denied. To fix that:

sudo chmod -R +X . # add the executable bit only for directories

The bad news is that if you do have any files you want to keep executable, such as .sh scripts, you'll need to revert those. You can do that with the following command for each file:

chmod +x ./build.sh # where build.sh is the file you want to make executable again
like image 49
Scott Willeke Avatar answered Oct 27 '22 09:10

Scott Willeke