{"thread":{"id":"24711","subject":"repo permissions repair: restore --shared=group permissions","startedAt":"2010-08-11T23:24:18Z","lastAt":"2010-08-25T03:42:54Z","messageCount":3,"participants":["Neal Kreitzinger","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"147841","messageId":"i3vbho$f5j$5@dough.gmane.org","threadId":"24711","inReplyTo":null,"subject":"repo permissions repair: restore --shared=group permissions","fromName":"Neal Kreitzinger","fromEmail":"neal@rsss.com","sentAt":"2010-08-11T23:24:18Z","receivedAt":"2010-08-11T23:24:18Z","isPatch":false,"sender":{"key":"neal@rsss.com","avatar":null},"body":"Hi,\n\nchmod -R 755 was inadvertantly run on all of our git repos (bare and \nnon-bare).  These repos were originally created as --shared=group.  When I \nrun git init --shared=group it does not complain, but it also does not \ncorrect the permissions.  Please advise on the best way restore the \npermissions to --shared=group.  Thanks!\n\nv/r,\nNeal \n"},{"id":"147844","messageId":"AANLkTik7w6rDa=dLp=cvU8JeuCn1ZjM9ateHU8m_UQkO@mail.gmail.com","threadId":"24711","inReplyTo":"i3vbho$f5j$5@dough.gmane.org","subject":"Re: repo permissions repair: restore --shared=group permissions","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-11T23:55:01Z","receivedAt":"2010-08-11T23:55:01Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Wed, Aug 11, 2010 at 23:24, Neal Kreitzinger <neal@rsss.com> wrote:\n> chmod -R 755 was inadvertantly run on all of our git repos (bare and\n> non-bare).  These repos were originally created as --shared=group.  When I\n> run git init --shared=group it does not complain, but it also does not\n> correct the permissions.  Please advise on the best way restore the\n> permissions to --shared=group.  Thanks!\n\nchmod -R g+rw ?\n"},{"id":"148931","messageId":"i523if$86m$5@dough.gmane.org","threadId":"24711","inReplyTo":"AANLkTik7w6rDa=dLp=cvU8JeuCn1ZjM9ateHU8m_UQkO@mail.gmail.com","subject":"Re: repo permissions repair: restore --shared=group permissions","fromName":"Neal Kreitzinger","fromEmail":"neal@rsss.com","sentAt":"2010-08-25T03:42:54Z","receivedAt":"2010-08-25T03:42:54Z","isPatch":false,"sender":{"key":"neal@rsss.com","avatar":null},"body":"\n\"Ævar Arnfjörð Bjarmason\" <avarab@gmail.com> wrote in message \nnews:AANLkTik7w6rDa=dLp=cvU8JeuCn1ZjM9ateHU8m_UQkO@mail.gmail.com...\nOn Wed, Aug 11, 2010 at 23:24, Neal Kreitzinger <neal@rsss.com> wrote:\n> chmod -R 755 was inadvertantly run on all of our git repos (bare and\n> non-bare). These repos were originally created as --shared=group. When I\n> run git init --shared=group it does not complain, but it also does not\n> correct the permissions. Please advise on the best way restore the\n> permissions to --shared=group. Thanks!\n\nchmod -R g+rw ?\n\nI followed your suggestion, but because I wasn't sure that would replicate \nwhat git would have done, I ended up restoring from tape after realizing \nthat the rsync backups were corrupted due to the git repos being in use \nduring the rsync.\n\nI then had a similar situation where I needed to lock down a central git \nrepository so that only the integration manager had write access.  Since git \ninit --shared=0644 would not do it for me, this is the method I used to \nensure that git set the permissions according to its rules:\n\n(Search Keywords: \"How to change the permissions of a Git Repo\")\n\nChange Permissions on an Existing Git Repo:\n\nCheck System for Users who may be using the Repo:\n# w  (see who's logged in)\n# ps -A |grep git-menu-scriptname  (where scriptname is some unique string \nin the name of the main script your users use to access that repo, if \napplicable)\n# skill -KILL pts/99  (where 99 = the pts/# from w command, log the user \noff)\n\nChange Shared=group to Shared=0644  (change group read+write to group read \nonly):\nCreate Template for permissions:\nlogin as fsngit0\n$ cd /path/to/template\n$ cat config\n[core]\n        sharedRepository = 0644\n\nClone repo to set permissions via git:\n$ cd /path/to/repo-parent-dir\n$ git clone --bare --template=/path/to/template REPO.git REPOMOD.git\n\nCompare old and new versions:\n$ diff -r REPO.git REPOMOD.git\nOnly in REPO.git: branches  (empty, keep the old version)\ndiff -r REPO.git/config REPOMOD.git/config  (merge the old and new together)\n1a2\n>       sharedrepository = 0644\n6,7c7\n<         denyDeletes = true\n<         denyNonFastForwards = true\n---\n>       denyNonFastforwards = true\nOnly in REPO.git: description  (keep the old version)\nOnly in REPO.git: gitk.cache  (gitk will recreate this)\nOnly in REPO.git: hooks  (contains sample scripts only or whatever scripts \nyour using, keep the old version)\nOnly in REPO.git: info  (keep the old version: contains attributes, exclude, \nor whatever you've setup)\ndiff -r REPO.git/packed-refs REPOMOD.git/packed-refs  (keep the new version \nbecause fresh clone has been optimized)\n2c2\n< Xa8b7b8c8fd3920b89770f2e8356f4ecb71a58cX refs/heads/master\n---\n> Ya69744e46276a37932d5f0755a53f76cdf83e0dY refs/heads/master\nOnly in REPO.git/refs/heads: master  (old version not needed because fresh \nclone has been optimized)\n\nCopy over REPO.git files that the clone didn't replicate, but that you need \nin order to retain all settings:\n$ cd /path/to/REPOMOD.git\n$ cp -rv /path/to/REPO.git/info .\nrepeat as needed...\n\nchange permissions to g-w or whatever your core.sharedRepository new value \nis supposed to be:\n$ chmod -R g-w info\nrepeat as needed...\n\nValidate your changes:\n$ diff -r REPO.git REPOMOD.git\ndiff -r REPO.git/config REPOMOD.git/config\n1a2\n>       sharedrepository = 0644\n7c8\n<         denyNonFastForwards = true\n---\n>       denyNonFastforwards = true\nOnly in REPO.git: gitk.cache\ndiff -r REPO.git/packed-refs REPOMOD.git/packed-refs\n2c2\n< Xa8b7b8c8fd3920b89770f2e8356f4ecb71a58cX refs/heads/master\n---\n> Y69744e46276a37932d5f0755a53f76cdf83e0dY refs/heads/master\nOnly in REPO.git/refs/heads: master\n\nBackup REPO.git and rename REPOMOD.git to REPO.git:\n$ cp -rvp REPO.git REPO.git-old\n$ diff -r REPO.git REPO.git-old\n$ rm -rf REPO.git\n$ cp -rvp REPOMOD.git REPO.git\n$ diff -r REPO.git REPOMOD.git\n$ diff -r REPO.git REPO.git-old\n"}]}