netok
netok

Reputation: 211

How to add file execute permission for owner only in Git on Windows?

I use Git on Windows and I want to push an executable shell script into my Git repository.

Here is a related question.

However, the question and solutions are about adding execute permission to everyone, effectively chmod ugo+x. I want to do chmod u+x.

Upvotes: 1

Views: 327

Answers (1)

Chris
Chris

Reputation: 136880

The only permissions that Git tracks (regardless of operating system) is the executable bit. This is by design:

Actually in a very early days, git used to record the full (mode & 0777) for blobs.

Once people started using git, everybody realized that it had a very unpleasant side effect that the resulting tree depended on user's umasks, because one person records a blob with mode 664 and the next person who modifies the file would record with mode 644, and it made it very hard to keep track of meaningful changes to the source code. This issue was fixed long time ago with commit e447947 (Be much more liberal about the file mode bits., 2005-04-16).

Note that Junio Hamano, the author of the quoted post, has been the main Git maintainer since 2005, shortly after it was created.

Granular execute permissions are best applied on deployment.

Upvotes: 2

Related Questions