user221137
user221137

Reputation:

Why is git creating read-only (444) files?

Using a shared repo (core.sharedRepository=group) we ran into some issues with git creating read-only (permissions 444) files. No matter which git config items I twiddle there always seems to be some read-only meta-data created on the server side when we push. These files are in .git/objects/ in a bare repo.

Do you really never need to write to these files again (regardless of what git operations you perform)? They may be representative of commit deltas, so really should not be changed, but I was hoping someone could clarify this.

For the inquisitive, the relevant lines look to be 856 and 867 of builtin/index-pack.c in git.

Upvotes: 17

Views: 5912

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 992717

Those files are part of the object database, which really is read-only. No matter what you do with Git, you can't change the contents of a specific object once it has been created.

Note that if you back out a commit and create a new one in its place, you'll be creating a new object with a new identifier and new contents. Git will eventually perform its garbage collection to remove the old, unreferenced object(s).

Upvotes: 21

Related Questions