2

I have used chmod to change permissions on a file. This file is in my Git repository. I changed it from 777 to 444. Git does not show any changes to the file. How do I add this change to Git?

Using Git verion 1.7.9.5

sheldonkreger
  • 858
  • 1
  • 9
  • 25

3 Answers3

2

You could remove the file from your repository and replace it with the file that you changed.

Will
  • 24,082
  • 14
  • 97
  • 108
feltersnach
  • 406
  • 3
  • 20
  • Feels hacky but is probably simpler than the solution in the related post pointed out by Lawrence Benson in the comment on my question. – sheldonkreger Jul 19 '15 at 23:18
  • 1
    @sheldonkreger Jacky a bit but probably the easiest way to do it. – feltersnach Jul 19 '15 at 23:25
  • I copied the file over to a different file name, then used git rm on the original file. Created a git commit for the delete. Then I changed the perms on the duplicate file and moved it back to the original file name. Added it in git, made a commit. That did it. – sheldonkreger Jul 19 '15 at 23:31
1

Git will only track whether the executable bit has changed. So, if you had a file that was 666 and changed it to 777, git would track this change, but otherwise does not track file permissions. If you need to track permissions with git, this will require third-party tools. This post explains it a bit. You'd need a third-party tool like git-cache-meta.

Will
  • 24,082
  • 14
  • 97
  • 108
1

from https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:unix_file_permissions

The Wrapper task adds appropriate file permissions to allow the execution of the gradlew *NIX command. Subversion preserves this file permission. We are not sure how other version control systems deal with this. What should always work is to execute “sh gradlew”

.

amutter
  • 81
  • 1
  • 9