Git changes my file permissions upon checkout

Git does not change file permissions or ownership. It’s just that it (mostly) doesn’t store it either, it doesn’t exist in your repo, so they get changed to whatever your user has. Just like with any file creation.

Git supports two permission sets: executable bit on and executable bit off. Nothing else. Ownership information is not stored at all.

See this thread – “If you want specific permissions, you’ll need to do it manually.”

There are some solutions suggested: you can use a separate tool to do it for you, use a proper combination of user account and umask to set them properly by default or write a git hook yourself to do it. A hook would’ve to be installed on the user doing the checkout.

Like @ikke said in the comments, Git is not really a deployment tool and should not be used as such. It is a version control system for source code.

Leave a Comment