I wanted to make some files in git read only. But I couldn't find any good documentation on doing this.
Does git store the read, write, execute permissions for files?
1 Answer. Show activity on this post. When Git checks out files, it by default uses the umask of the file on the system, setting the executable bit if it's a directory or it's marked as an executable file. That's because Git removes and re-creates the file, so it doesn't preserve the permissions of the existing file.
false : git does not track it.
Git is Version Control System, created for software development, so from the whole set of modes and permissions it stores only executable bit (for ordinary files) and symlink bit. If you want to store full permissions, you need third party tool, like git-cache-meta (mentioned by VonC), or Metastore (used by etckeeper).
According to kernel.org git does not store all the permissions possible for files.
Git is a content tracker, where content is de facto defined as "whatever is relevant to the state of a typical sourcecode tree". Basically, this is just files' data and "executable" attribute.
So git stores only the content in the file and the execute bit.
(This is probably a design choice. Probably driven partly by the fact that not all file systems are the same.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With