Score:0

How to force custom permissions on files created by git checkout command?

gl flag

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.

Score:0
cn flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.