- 1 year ago
After git pull on server, permissions get changed
When you perform a git pull
on a server, the permissions of the files may change based on your Git configuration and the operating system's file permission settings. Here are a few possible reasons for the permissions change:
Git configuration: Git may change the permissions based on the configuration settings. For example, Git can honor the executable bit of files when committing and pulling changes. If a file is marked as executable in the repository, Git may set the executable bit when pulling the file.
Git attributes: Git attributes allow you to specify how files should be treated when committed and checked out. For example, you can use
.gitattributes
to set the line-ending style or specify files as binary. Git attributes can also control file permissions.Git hooks: If there are Git hooks set up on the server, they can modify file permissions during the
git pull
operation.File system settings: The behavior of file permissions during
git pull
can also depend on the file system used on the server and its specific settings.
To control the file permissions after a git pull
, you can consider the following:
Set a default file permission for the repository using Git's
core.sharedRepository
configuration option:arduinogit config core.sharedRepository <mode>
Replace
<mode>
with the desired permission mode, such asgroup
orall
.Use Git attributes to specify explicit file permissions for certain files or directories.
Check if there are any Git hooks running on the server that modify file permissions during
git pull
. Review and modify the hooks if needed.
Please note that changing file permissions in a shared repository can have security implications, so make sure to carefully review and test any changes before implementing them on a production server. Additionally, permissions behavior can be different on different operating systems, so be aware of the specific behavior on your server's operating system.