0

I have reviewed a bunch of useful stuff, but still not clear how to do what I need (How do i change file ownership after git commit; How to keep git from changing file ownership; Making git push respect permissions?; Retaining file permissions with Git)

Given that significant time has gone by, is there now a simple, straightforward solution?

What do you do?

Attempting to:
- Code/test in windows dev environment (XAMPP)
- Create/manage different code versions (GIT)
- Push code versions to remote repo ... on WAMP server (GIT)
- Checkout different versions from repo into dev and/or into live environments (GIT)

So far, so obvious - core use case for GIT, almost everyone needs to do this?

BUT complexity:
- in order to actually run in the live environment (which is kind of the point) files and permissions need to be correct
- code is spread across htdocs (primary site), symlink directory (end-user accessible content like graphics etc), and non-user-accessible source code (held above www root)
- these different areas need different user ownership -> different permissions

Problem: as identified in one form or another by all referenced questions:
- Git overwrites file ownership with owner:group of user running the git command, and messes up permissions required to actually run the application

Ideal Solution:
- A tool which understands/maintains which ownership settings and permissions are needed for the target environment, e.g. on a directory by directory basis: files in Directory A should have ownerA, groupB and permissions xyzxyzxyz and is able to re-apply them after git messes it all up

Considered so far:
OPTION 1: in-Git functionality or flag setting to allow this.

- NO: 'git is not a deployment tool'

OPTION 2: use git-cache-meta to store file settings, then to apply file settings again afterwards.
- NO: files come from Windows dev environment that does not have Unix type permissions, so can't work off incoming permissions

OPTION 3: use (radically under-documented and effectively expert-only) metastore
- NO: from what I can understand, same problem as Option 2

OPTION 4: find, research and experiment with a whole additional set of tools (e.g. Deployer, Gitolite), which appear to be designed to do a whole range of other things and may or may not do what I am looking for
- MAYBE: but, if so: which one can do this? what do you use? what is easy/simple to implement?

OPTION 5: set Group ID on relevant directories to force 'Group' ownership
- NO: this won't help with 'Owner', or permissions

Community
  • 1
  • 1
  • Why not have a makefile with a "deploy" target, and have the repo elsewhere on the path. – Ignacio Vazquez-Abrams Feb 01 '16 at 15:09
  • @Ignacio Potentially, or any automating shell script I suppose ... probably better as a post-receive hook. I was really hoping for a simpler route than having to write scripts to handle it. – user3600150 Feb 02 '16 at 11:18

1 Answers1