{"thread":{"id":"23693","subject":"preserve permissions?","startedAt":"2010-05-04T12:29:50Z","lastAt":"2012-03-03T19:15:58Z","messageCount":5,"participants":["Jonathan Chetwynd","Jakub Narebski","Andrew Keller","snk"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"140904","messageId":"C1288762-C750-4919-A853-5E3229870A59@btinternet.com","threadId":"23693","inReplyTo":null,"subject":"preserve permissions?","fromName":"Jonathan Chetwynd","fromEmail":"j.chetwynd@btinternet.com","sentAt":"2010-05-04T12:29:50Z","receivedAt":"2010-05-04T12:29:50Z","isPatch":false,"sender":{"key":"j.chetwynd@btinternet.com","avatar":"https://gravatar.com/avatar/7a76e3d500b1da77e7f2d624f7501d8e6c9c60b2d23d22576203a3a260602586?d=mp&s=160"},"body":"git clone ../xsl-test/\n\nthe original has a single directory, owner _www, and a few files.\n\nhowever the clone directory has owner Me.\n\nwhat is the reason permissions are not preserved?\n\nregards\n\nJonathan Chetwynd\n\ntesting git before moving a development project to git for production\n"},{"id":"140905","messageId":"m3fx27g6i8.fsf@localhost.localdomain","threadId":"23693","inReplyTo":"C1288762-C750-4919-A853-5E3229870A59@btinternet.com","subject":"Re: preserve permissions?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-04T13:08:00Z","receivedAt":"2010-05-04T13:08:00Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jonathan Chetwynd <j.chetwynd@btinternet.com> writes:\n\n> git clone ../xsl-test/\n> \n> the original has a single directory, owner _www, and a few files.\n> \n> however the clone directory has owner Me.\n> \n> what is the reason permissions are not preserved?\n\nWhy should permissions be preserved?  Git is a version control system,\nmeant mainly for software management, not a backup system.  \n\nWhen you clone repository from somebody, you don't want for files to\nhave that somebody ownership, especially that such user most probably\ndo not exist on your machine.\n\nTherefore git does not store ownership, and only basic permissions\n(only executable bit for ordinary files, and the symlink bit).\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"140930","messageId":"1D033321-2F57-44BF-B27F-D7450AFC85E6@kellerfarm.com","threadId":"23693","inReplyTo":"C1288762-C750-4919-A853-5E3229870A59@btinternet.com","subject":"Re: preserve permissions?","fromName":"Andrew Keller","fromEmail":"andrew@kellerfarm.com","sentAt":"2010-05-04T18:44:15Z","receivedAt":"2010-05-04T18:44:15Z","isPatch":false,"sender":{"key":"andrew@kellerfarm.com","avatar":"https://avatars.githubusercontent.com/u/304204?v=4"},"body":"On May 4, 2010, at 8:29 AM, Jonathan Chetwynd wrote:\n\n> ...\n> \n> what is the reason permissions are not preserved?\n> \n> ...\n\n\nGit implements a network of trust permission model.  In this model, system permissions are used (among other things) to control who has access to a repository.  Once someone has access, they can perform a clone or a fetch.  This process downloads refs into a local repository that inherits your local permissions.  This model is simple, but it is often capable of most things that system permissions can do, and it avoids the problem of a given user in the repository not existing on a machine.\n\nOne of the implications of this model is that although system permissions can be used to control who has access to a repository, they are not stored in the repository itself.  This means that if you clone a repository, the system permissions of the repository are never preserved.  This is a very intentional detail of the network of trust permission model.  Once a user has access to a repository, that user has access to the whole repository.  It is exactly like telling another person something.  Once the other person hears the data, that person can do whatever he or she wants with it.  He or she \"owns\" a copy of the data.\n\nIn other words, if you want a user X to own a repository upon cloning, then user X must be the one to perform the clone.  If you want Sue to know that the new kitchen table is made of oak, then Sue must be the one to ask the question (aka clone or fetch).  You cannot ask the question for Sue and expect her to instantly know what you know.\n\nHTH\n~ Andrew Keller\n"},{"id":"186008","messageId":"1330801530552-7340464.post@n2.nabble.com","threadId":"23693","inReplyTo":"m3fx27g6i8.fsf@localhost.localdomain","subject":"Re: preserve permissions?","fromName":"snk","fromEmail":"shank76@gmail.com","sentAt":"2012-03-03T19:05:30Z","receivedAt":"2012-03-03T19:05:30Z","isPatch":false,"sender":{"key":"shank76@gmail.com","avatar":null},"body":"> Therefore git does not store ownership, and only basic permissions \n> (only executable bit for ordinary files, and the symlink bit). \n\nFine.  \"git diff\" reports wrong new permissions though: 755 instead of 764. \n\nshanker@linux-0tix:~/test/play2> git reset --hard HEAD\nHEAD is now at 85d4483 test\nshanker@linux-0tix:~/test/play2> git config core.filemode\ntrue\nshanker@linux-0tix:~/test/play2> ls -l x\n-rw-rw-r-- 1 shanker users 0 Mar  3 11:00 x\nshanker@linux-0tix:~/test/play2> chmod u+x x\nshanker@linux-0tix:~/test/play2> git diff x\ndiff --git a/x b/x\nold mode 100644\nnew mode 100755\nshanker@linux-0tix:~/test/play2> ls -l x\n-rwxrw-r-- 1 shanker users 0 Mar  3 11:00 x\nshanker@linux-0tix:~/test/play2> \n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/preserve-permissions-tp5003065p7340464.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"186009","messageId":"m3wr71ts0i.fsf@localhost.localdomain","threadId":"23693","inReplyTo":"1330801530552-7340464.post@n2.nabble.com","subject":"Re: preserve permissions?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2012-03-03T19:15:58Z","receivedAt":"2012-03-03T19:15:58Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"snk <shank76@gmail.com> writes:\n\n> > Therefore git does not store ownership, and only basic permissions \n> > (only executable bit for ordinary files, and the symlink bit). \n> \n> Fine.  \"git diff\" reports wrong new permissions though: 755 instead of 764. \n\n\"Executable bit\" is not \"executable permissions\"\n \n> shanker@linux-0tix:~/test/play2> git reset --hard HEAD\n> HEAD is now at 85d4483 test\n> shanker@linux-0tix:~/test/play2> git config core.filemode\n> true\n> shanker@linux-0tix:~/test/play2> ls -l x\n> -rw-rw-r-- 1 shanker users 0 Mar  3 11:00 x\n> shanker@linux-0tix:~/test/play2> chmod u+x x\n> shanker@linux-0tix:~/test/play2> git diff x\n> diff --git a/x b/x\n> old mode 100644\n> new mode 100755\n> shanker@linux-0tix:~/test/play2> ls -l x\n> -rwxrw-r-- 1 shanker users 0 Mar  3 11:00 x\n> shanker@linux-0tix:~/test/play2> \n\nGit stores only whether file is executable or not.  To be more exact\ngit uses only a few modes: one for submodule (commit), one for\ndirectory, one for symbolic link, one for ordinary executable file,\nand one for ordinary file (non-executable).\n\n-- \nJakub Narebski\n"}]}