{"thread":{"id":"35675","subject":"file permissions in Git repo","startedAt":"2014-01-16T23:58:57Z","lastAt":"2014-01-17T20:11:19Z","messageCount":6,"participants":["SH","Jeff King","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"233238","messageId":"1389916737.92225.YahooMailNeo@web124906.mail.ne1.yahoo.com","threadId":"35675","inReplyTo":null,"subject":"file permissions in Git repo","fromName":"SH","fromEmail":"saajey@yahoo.com","sentAt":"2014-01-16T23:58:57Z","receivedAt":"2014-01-16T23:58:57Z","isPatch":false,"sender":{"key":"saajey@yahoo.com","avatar":null},"body":"\n\nHi\n\n\nWe have a repository which holds lots of shell and perl scripts. We add the\nfiles to repository (from windows client) with executable permissions (using\ncygwin) but when we pull that repository on another machine (windows or linux),\nfiles dont have executable permission. Can you please provide a solutions for\nthis?\n\nWe also tried post-commit and post-receive hooks to set the permission but\nit didnt seem to work either.\n\n\nThanks\n"},{"id":"233251","messageId":"20140117022623.GC12444@sigill.intra.peff.net","threadId":"35675","inReplyTo":"1389916737.92225.YahooMailNeo@web124906.mail.ne1.yahoo.com","subject":"Re: file permissions in Git repo","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-01-17T02:26:23Z","receivedAt":"2014-01-17T02:26:23Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 16, 2014 at 03:58:57PM -0800, SH wrote:\n\n> We have a repository which holds lots of shell and perl scripts. We add the\n> files to repository (from windows client) with executable permissions (using\n> cygwin) but when we pull that repository on another machine (windows or linux),\n> files dont have executable permission. Can you please provide a solutions for\n> this?\n\nGit does not preserve file permissions _except_ for the executable bit.\nSo this should be working.\n\nHowever, I suspect that `core.fileMode` is set to `false` in your\nrepository, which causes git to ignore the executable bit. When a\nrepository is initialized, we check whether the filesystem simply\ncreates everything with the executable bit. If so, we turn off\ncore.fileMode for the repository (since otherwise every file would have\nit set).\n\n-Peff\n"},{"id":"233293","messageId":"52D971A7.1040104@web.de","threadId":"35675","inReplyTo":"20140117022623.GC12444@sigill.intra.peff.net","subject":"Re: file permissions in Git repo","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-01-17T18:08:39Z","receivedAt":"2014-01-17T18:08:39Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 01/17/2014 03:26 AM, Jeff King wrote:\n> On Thu, Jan 16, 2014 at 03:58:57PM -0800, SH wrote:\n>\n>> We have a repository which holds lots of shell and perl scripts. We add the\n>> files to repository (from windows client) with executable permissions (using\n>> cygwin) but when we pull that repository on another machine (windows or linux),\n>> files dont have executable permission. Can you please provide a solutions for\n>> this?\n>\n> Git does not preserve file permissions _except_ for the executable bit.\n> So this should be working.\n>\n> However, I suspect that `core.fileMode` is set to `false` in your\n> repository, which causes git to ignore the executable bit. When a\n> repository is initialized, we check whether the filesystem simply\n> creates everything with the executable bit. If so, we turn off\n> core.fileMode for the repository (since otherwise every file would have\n> it set).\n>\n> -Peff\nCygwin has been a little bit special (and mingw still is).\nUntil this commit:\nAuthor: Junio C Hamano <gitster@pobox.com>\nDate:   Wed Jul 24 19:22:49 2013 -0700\n\n    Merge branch 'ml/cygwin-updates'\n\n    The tip one does _not_ revert c869753e (Force core.filemode to\n    false on Cygwin., 2006-12-30) on purpose, so that people can\n    still retain the old behaviour if they wanted to.\n\n    * ml/cygwin-updates:\n      cygwin: stop forcing core.filemode=false\n      Cygwin 1.7 supports mmap\n      Cygwin 1.7 has thread-safe pread\n      Cygwin 1.7 needs compat/regex\nthe repositories created by cygwin had always core.filemode=false.\n\nYou can easily check your configuration by running\ngit config -l\non the cygwin machine, as Peff suggested.\n\nThe next step is to check how the files had been recored in git, using\ngit ls-files -s | less\non any machine.\n\nIf I do this on git.git, we find lines like this, where\n100755 means an executable file,\n100644 means non-executable file.\n\n100755 9c3f4131b8586408acd81d1e60912b51688575ed 0 \nDocumentation/technical/api-index.sh\n100644 dd894043ae8b04269b3aa2108f96cb935217181d 0 \nDocumentation/technical/api-lockfile.txt\n\n\nThe 3rd step is to check how file are shown in cygwin, run\nls -l\n(Do they have the executable bit set ?)\n\nSide note:\nAnd I think the way the auto-probing of the file system works is\nlike this:\nWhen a git repo is initialized, the .git/config file is created.\nAfter that, we try to toggle the executable bit, and if lstat reports\nit as toggled, we set core.filemode=true.\n(See builtin/init-db.c, search for core.filemode)\n\nI tested to create a repo on a network share exported by SAMBA.\nThe Server was configured so that all new created files had the\nexecutable bit set by default.\nGit detected that the executable bit could be switched off,\nand configured core.filemode=true\nNice.\n\n/Torsten\n"},{"id":"233304","messageId":"1389986459.3994.YahooMailNeo@web124902.mail.ne1.yahoo.com","threadId":"35675","inReplyTo":"52D971A7.1040104@web.de","subject":"Re: file permissions in Git repo","fromName":"SH","fromEmail":"saajey@yahoo.com","sentAt":"2014-01-17T19:20:59Z","receivedAt":"2014-01-17T19:20:59Z","isPatch":false,"sender":{"key":"saajey@yahoo.com","avatar":null},"body":"Thanks guys.  Sorry but one more question, like I mentioned we have hosted repositories so how do I make some configuration changes are server based so whether the client have those changes or not, it wouldn't matter. Also I have one client on linux and another one on windows (for my testing purpose) and I see that .git/config on both machines are little different. Is that normal?\n\nThanks Again.\n\n\n\n\n\nOn Friday, January 17, 2014 10:08 AM, Torsten Bögershausen <tboegi@web.de> wrote:\nOn 01/17/2014 03:26 AM, Jeff King wrote:\n\n> On Thu, Jan 16, 2014 at 03:58:57PM -0800, SH wrote:\n>\n>> We have a repository which holds lots of shell and perl scripts. We add the\n>> files to repository (from windows client) with executable permissions (using\n>> cygwin) but when we pull that repository on another machine (windows or linux),\n>> files dont have executable permission. Can you please provide a solutions for\n>> this?\n>\n> Git does not preserve file permissions _except_ for the executable bit.\n> So this should be working.\n>\n> However, I suspect that `core.fileMode` is set to `false` in your\n> repository, which causes git to ignore the executable bit. When a\n> repository is initialized, we check whether the filesystem simply\n> creates everything with the executable bit. If so, we turn off\n> core.fileMode for the repository (since otherwise every file would have\n> it set).\n>\n> -Peff\nCygwin has been a little bit special (and mingw still is).\nUntil this commit:\nAuthor: Junio C Hamano <gitster@pobox.com>\nDate:   Wed Jul 24 19:22:49 2013 -0700\n\n    Merge branch 'ml/cygwin-updates'\n\n    The tip one does _not_ revert c869753e (Force core.filemode to\n    false on Cygwin., 2006-12-30) on purpose, so that people can\n    still retain the old behaviour if they wanted to.\n\n    * ml/cygwin-updates:\n      cygwin: stop forcing core.filemode=false\n      Cygwin 1.7 supports mmap\n      Cygwin 1.7 has thread-safe pread\n      Cygwin 1.7 needs compat/regex\nthe repositories created by cygwin had always core.filemode=false.\n\nYou can easily check your configuration by running\ngit config -l\non the cygwin machine, as Peff suggested.\n\nThe next step is to check how the files had been recored in git, using\ngit ls-files -s | less\non any machine.\n\nIf I do this on git.git, we find lines like this, where\n100755 means an executable file,\n100644 means non-executable file.\n\n100755 9c3f4131b8586408acd81d1e60912b51688575ed 0 \nDocumentation/technical/api-index.sh\n100644 dd894043ae8b04269b3aa2108f96cb935217181d 0 \nDocumentation/technical/api-lockfile.txt\n\n\nThe 3rd step is to check how file are shown in cygwin, run\nls -l\n(Do they have the executable bit set ?)\n\nSide note:\nAnd I think the way the auto-probing of the file system works is\nlike this:\nWhen a git repo is initialized, the .git/config file is created.\nAfter that, we try to toggle the executable bit, and if lstat reports\nit as toggled, we set core.filemode=true.\n(See builtin/init-db.c, search for core.filemode)\n\nI tested to create a repo on a network share exported by SAMBA.\nThe Server was configured so that all new created files had the\nexecutable bit set by default.\nGit detected that the executable bit could be switched off,\nand configured core.filemode=true\nNice.\n\n/Torsten\n"},{"id":"233309","messageId":"52D98AC7.9030101@web.de","threadId":"35675","inReplyTo":"1389986459.3994.YahooMailNeo@web124902.mail.ne1.yahoo.com","subject":"Re: file permissions in Git repo","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-01-17T19:55:51Z","receivedAt":"2014-01-17T19:55:51Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"(Please no top posting next time)\nOn 2014-01-17 20.20, SH wrote:\n> On Friday, January 17, 2014 10:08 AM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 01/17/2014 03:26 AM, Jeff King wrote:\n> \n>> On Thu, Jan 16, 2014 at 03:58:57PM -0800, SH wrote:\n>>\n>>> We have a repository which holds lots of shell and perl scripts. We add the\n>>> files to repository (from windows client) with executable permissions (using\n>>> cygwin) but when we pull that repository on another machine (windows or linux),\n>>> files dont have executable permission. Can you please provide a solutions for\n>>> this?\n>>\n>> Git does not preserve file permissions _except_ for the executable bit.\n>> So this should be working.\n>>\n>> However, I suspect that `core.fileMode` is set to `false` in your\n>> repository, which causes git to ignore the executable bit. When a\n>> repository is initialized, we check whether the filesystem simply\n>> creates everything with the executable bit. If so, we turn off\n>> core.fileMode for the repository (since otherwise every file would have\n>> it set).\n>>\n>> -Peff\n> Cygwin has been a little bit special (and mingw still is).\n> Until this commit:\n> Author: Junio C Hamano <gitster@pobox.com>\n> Date:   Wed Jul 24 19:22:49 2013 -0700\n> \n>     Merge branch 'ml/cygwin-updates'\n> \n>     The tip one does _not_ revert c869753e (Force core.filemode to\n>     false on Cygwin., 2006-12-30) on purpose, so that people can\n>     still retain the old behaviour if they wanted to.\n> \n>     * ml/cygwin-updates:\n>       cygwin: stop forcing core.filemode=false\n>       Cygwin 1.7 supports mmap\n>       Cygwin 1.7 has thread-safe pread\n>       Cygwin 1.7 needs compat/regex\n> the repositories created by cygwin had always core.filemode=false.\n> \n> You can easily check your configuration by running\n> git config -l\n> on the cygwin machine, as Peff suggested.\n> \n> The next step is to check how the files had been recored in git, using\n> git ls-files -s | less\n> on any machine.\n> \n> If I do this on git.git, we find lines like this, where\n> 100755 means an executable file,\n> 100644 means non-executable file.\n> \n> 100755 9c3f4131b8586408acd81d1e60912b51688575ed 0 \n> Documentation/technical/api-index.sh\n> 100644 dd894043ae8b04269b3aa2108f96cb935217181d 0 \n> Documentation/technical/api-lockfile.txt\n> \n> \n> The 3rd step is to check how file are shown in cygwin, run\n> ls -l\n> (Do they have the executable bit set ?)\n> \n> Side note:\n> And I think the way the auto-probing of the file system works is\n> like this:\n> When a git repo is initialized, the .git/config file is created.\n> After that, we try to toggle the executable bit, and if lstat reports\n> it as toggled, we set core.filemode=true.\n> (See builtin/init-db.c, search for core.filemode)\n> \n> I tested to create a repo on a network share exported by SAMBA.\n> The Server was configured so that all new created files had the\n> executable bit set by default.\n> Git detected that the executable bit could be switched off,\n> and configured core.filemode=true\n> Nice.\n> \n> /Torsten\n> Thanks guys.  Sorry but one more question, like I mentioned we have hosted repositories so how do I make some configuration changes are server based so whether the client have those changes or not, it wouldn't matter. Also I have one client on linux and another one on windows (for my testing purpose) and I see that .git/config on both machines are little different. Is that normal?\n> \n> Thanks Again.\nThat a config file has small differences could be normal:\nthe server has typically core.bare true.\n\nAbout other differences, please don't heasitate to consult\nhttp://git-htmldocs.googlecode.com/git/git-config.html\n\nAnd if there are still questions, they are there to be answered here.\n/Torsten\n"},{"id":"233315","messageId":"1389989479.82735.YahooMailNeo@web124901.mail.ne1.yahoo.com","threadId":"35675","inReplyTo":"52D98AC7.9030101@web.de","subject":"Re: file permissions in Git repo","fromName":"SH","fromEmail":"saajey@yahoo.com","sentAt":"2014-01-17T20:11:19Z","receivedAt":"2014-01-17T20:11:19Z","isPatch":false,"sender":{"key":"saajey@yahoo.com","avatar":null},"body":"Thanks again.\n\n\n\n\n\nOn Friday, January 17, 2014 11:55 AM, Torsten Bögershausen <tboegi@web.de> wrote:\n(Please no top posting next time)\nOn 2014-01-17 20.20, SH wrote:\n> On Friday, January 17, 2014 10:08 AM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 01/17/2014 03:26 AM, Jeff King wrote:\n> \n>> On Thu, Jan 16, 2014 at 03:58:57PM -0800, SH wrote:\n>>\n>>> We have a repository which holds lots of shell and perl scripts. We add the\n>>> files to repository (from windows client) with executable permissions (using\n>>> cygwin) but when we pull that repository on another machine (windows or linux),\n>>> files dont have executable permission. Can you please provide a solutions for\n>>> this?\n>>\n>> Git does not preserve file permissions _except_ for the executable bit.\n>> So this should be working.\n>>\n>> However, I suspect that `core.fileMode` is set to `false` in your\n>> repository, which causes git to ignore the executable bit. When a\n>> repository is initialized, we check whether the filesystem simply\n>> creates everything with the executable bit. If so, we turn off\n>> core.fileMode for the repository (since otherwise every file would have\n>> it set).\n>>\n>> -Peff\n> Cygwin has been a little bit special (and mingw still is).\n> Until this commit:\n> Author: Junio C Hamano <gitster@pobox.com>\n> Date:   Wed Jul 24 19:22:49 2013 -0700\n> \n>     Merge branch 'ml/cygwin-updates'\n> \n>     The tip one does _not_ revert c869753e (Force core.filemode to\n>     false on Cygwin., 2006-12-30) on purpose, so that people can\n>     still retain the old behaviour if they wanted to.\n> \n>     * ml/cygwin-updates:\n>       cygwin: stop forcing core.filemode=false\n>       Cygwin 1.7 supports mmap\n>       Cygwin 1.7 has thread-safe pread\n>       Cygwin 1.7 needs compat/regex\n> the repositories created by cygwin had always core.filemode=false.\n> \n> You can easily check your configuration by running\n> git config -l\n> on the cygwin machine, as Peff suggested.\n> \n> The next step is to check how the files had been recored in git, using\n> git ls-files -s | less\n> on any machine.\n> \n> If I do this on git.git, we find lines like this, where\n> 100755 means an executable file,\n> 100644 means non-executable file.\n> \n> 100755 9c3f4131b8586408acd81d1e60912b51688575ed 0 \n> Documentation/technical/api-index.sh\n> 100644 dd894043ae8b04269b3aa2108f96cb935217181d 0 \n> Documentation/technical/api-lockfile.txt\n> \n> \n> The 3rd step is to check how file are shown in cygwin, run\n> ls -l\n> (Do they have the executable bit set ?)\n> \n> Side note:\n> And I think the way the auto-probing of the file system works is\n> like this:\n> When a git repo is initialized, the .git/config file is created.\n> After that, we try to toggle the executable bit, and if lstat reports\n> it as toggled, we set core.filemode=true.\n> (See builtin/init-db.c, search for core.filemode)\n> \n> I tested to create a repo on a network share exported by SAMBA.\n> The Server was configured so that all new created files had the\n> executable bit set by default.\n> Git detected that the executable bit could be switched off,\n> and configured core.filemode=true\n> Nice.\n> \n> /Torsten\n> Thanks guys.  Sorry but one more question, like I mentioned we have hosted repositories so how do I make some configuration changes are server based so whether the client have those changes or not, it wouldn't matter. Also I have one client on linux and another one on windows (for my testing purpose) and I see that .git/config on both machines are little different. Is that normal?\n> \n> Thanks Again.\nThat a config file has small differences could be normal:\nthe server has typically core.bare true.\n\nAbout other differences, please don't heasitate to consult\nhttp://git-htmldocs.googlecode.com/git/git-config.html\n\nAnd if there are still questions, they are there to be answered here.\n\n/Torsten\n"}]}