0

Problem: Every git aws.push changes permissions on phpMyAdmin/config.inc.php to 666 and needs to be 555

Overview: I have an Amazon AWS elastic beanstalk site with PHP / MySQL. In the site files, I have phpMyAdmin in the folder /phpmyadmin. My desktop computer is running windows 7. I've done the following:

  • edited config.inc.php to include the necessary fields to connect to my MySQL dB
  • performed git add to put under version control
  • performed git commit to commit the file
  • performed git aws.push to move the file to the server
  • executed ssh to server to perform chmod 755 to the file
  • launched phpMyAdmin from the browser and successfully connected

Any subsequent git aws.push causes the permissions on config.inc.php to be reset to 666 so I can no longer connect with phpMyAdmin until I run the SSH and execute the chmod

Failed Solution

  • created .gitignore file in /phpmyadmin folder
  • added config.inc.php to the .gitignore file
  • executed git rm --cached config.inc.php to take the file out from source control

I then proceeded to execute an edit / git add / git commit / git aws.push on another file

The result was that /phpmyadmin/config.inc.php was removed from the server rather than just being ignored for the push

Desired Solution /phpmyadmin/config.inc.php on the AWS server with the permissions remaining at 755 when other files are updated and pushed to the server

Cheesepipe
  • 71
  • 1
  • 5

1 Answers1

0

Give this a shot

git config --local core.filemode false

And read this posting, it might help: How do I make Git ignore file mode (chmod) changes?

What this does: Tells Git to ignore chmod changes, therefore preventing an add/commit of that file that has changed only it's permissions, not content. This essentially means that the file you're using chmod on is never pushed to the repo (since it's never add/commit'ed) -- the version on the repo will remain unchanged unless you actually alter it's contents locally, in which case Git will see it and consider it a changed file ready for add/commit.

I hope that made sense...

Any time you change the contents of the file, you're most likely going to have to ssh into AWS to chmod the file. A server-side Git hook might resolve this for you (automatically chmod 755 your config file.)

http://git-scm.com/book/en/Customizing-Git-Git-Hooks#Server-Side-Hooks

Community
  • 1
  • 1
kmatheny
  • 4,042
  • 1
  • 19
  • 12
  • Makes sense that any change to the file (config.inc.php) will require follow up to perform the change mod. Unfortunately, I tried git config --local core.filemode false and git config core.filemode false both in git BASH and in the windows terminal where I execute git aws.push, but git keeps on updating the permissions on config.inc.php on the AWS server – Cheesepipe Jul 27 '13 at 03:19
  • Shoot :\ If that isn't working for you, then you might want to check into server-side Git Hooks. You can set those up to run any script after receiving a push (e.g., chmod'ing config.inc.php after each push it receives.) This may not be ideal, but it could be a work-around for the time being. – kmatheny Jul 29 '13 at 17:32
  • Thanks, I'll look into this as an option. Not exactly sure where to start with this within the AWS environment – Cheesepipe Sep 24 '13 at 03:12