0

I need files created by git checkout command to have custom permissions.

Even with core.sharedrepository=0777 setting git creates working tree files with 0644 permissions. But I want it to be at least 0664 so someone from the group could write to them (it also would be very good to specify a custom owner group)

Applying recursively chown/chmod may work but it smells like the last resort and resource waste.

1 Answers1

0

Do not use just git to manage the file permissions of an installed tree.

git is single user. It does not track file ownership and permissions sufficient to secure a multiple user system. Even if a simple tree wide core.sharedrepository with one user were sufficient for your use case, you are having difficulty getting it do what you want. Possibly its still using the default of umask ?

Consider a real archive format, either a software package system, or generic archive like tar. Get the permissions correct in the scripts that generate the archives.

Or, running a permissions fix script isn't that bad. If desired, check permissions prior to changing them, to avoid unnecessary changes to file metadata.


Unrelated consideration: if this tree is going to be updated, be aware that git doesn't sync files, it merges histories. Understand these git deployment rules to appreciate why scripting just git pull is probably wrong.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34