21

I'm working on Windows and on the production there's a Linux system and I'd like to chmod some files to 0777, but I don't know how to do it on Windows. I rather not do it on production, because I'm unable to commit/push there.

Is there a way to chmod 0777 a file on Windows and commit it to Git so that it stays 0777 when I clone/pull on the production?

2
  • When you are using GIT Bash or GIT Shell on windows it should allow the chmod command. Commented Nov 19, 2012 at 13:35
  • 2
    Do you just want it executable (0755) or do you really want it 0777? Commented Nov 19, 2012 at 15:05

2 Answers 2

41

If you want to mark the file as executable, you can use

git update-index --chmod=+x <your_file> 

If you really want to have the file writable for everyone, you would have to set up a post-update hook on the linux system, because git does not track file permissions, only the executable bit.

Sign up to request clarification or add additional context in comments.

Comments

-1

An alternative solution is to install Cygwin on Windows.

Cygwin emulates a Unix-like environment but all cygwin programs run natively on your Windows machine. It is not a virtual machine. However, cygwin binaries are compiled with the cygwin libraries which allows them to understand stuff like unix style file permissions that normal Windows programs don't understand.

So you need to install a version of git for Cygwin. Just select git from the Cygwin installer when first installing Cygwin.

2 Comments

Cygwin claimed my file was already +x, but when checked on a Unix-like machine it was not. Running chmod +x <file> did not change the executable bit that git was tracking. The answer by @crater2150 worked.
ditto, seemingly not sufficient. git update-index as per @creater2150 worked for me too.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.