maaartinus
maaartinus

Reputation: 46372

How to stop git from making files non-executable on cygwin?

I use git on Windows via cygwin and soon decided to use filemode=false (since otherwise I've got a lot of changes after the initial git clone). I'm definitely not interested in tracking permission at all, the only think I need is for some files to be executable. From time to time, I find that the x flag on some files gets lost and I strongly suppose it's because of git.

I'd be happy with a solution allowing to execute chmod a+x ... when needed.

Upvotes: 59

Views: 26550

Answers (4)

jasie
jasie

Reputation: 2444

For me, this command worked:

git add --chmod=+x -- <file>

Commit after that (and push), done.

In Bitbucket pull request before:

before

After (just the one commit):

after

After (all changes):

enter image description here

The difference between git update-index and git add is explained in this StackOverflow Question.

Upvotes: 1

Alexander Pogrebnyak
Alexander Pogrebnyak

Reputation: 45576

You should start with git update-index --chmod=+x <file>.

But this does not change your working copy, for that:

git checkout .

Upvotes: 6

think2010
think2010

Reputation: 101

I've met the same problem. git update-index --chomd=+x doesn't work for me.

I use chmod +x , then commit, it works perfect.

Upvotes: 5

Karl Bielefeldt
Karl Bielefeldt

Reputation: 49008

I believe you want git update-index --chmod=+x <file>, followed by a commit.

Upvotes: 107

Related Questions