How do I make a git server accessible to multiple users?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
2












I have set up a git server, but I'm having some problems with users pushing their commits. I have a total of 3 users, but if any one of them pushes some files, they become read-only for the other users, and the unpacker fails if they try to push.



I can temporarily fix this issue by recursively setting all permissions to 777 but that is a terrible approach and only fixes it until the next push.



How can I make it so that all selected users can both push and pull, without having to change permissions every single time?







share|improve this question


























    up vote
    2
    down vote

    favorite
    2












    I have set up a git server, but I'm having some problems with users pushing their commits. I have a total of 3 users, but if any one of them pushes some files, they become read-only for the other users, and the unpacker fails if they try to push.



    I can temporarily fix this issue by recursively setting all permissions to 777 but that is a terrible approach and only fixes it until the next push.



    How can I make it so that all selected users can both push and pull, without having to change permissions every single time?







    share|improve this question
























      up vote
      2
      down vote

      favorite
      2









      up vote
      2
      down vote

      favorite
      2






      2





      I have set up a git server, but I'm having some problems with users pushing their commits. I have a total of 3 users, but if any one of them pushes some files, they become read-only for the other users, and the unpacker fails if they try to push.



      I can temporarily fix this issue by recursively setting all permissions to 777 but that is a terrible approach and only fixes it until the next push.



      How can I make it so that all selected users can both push and pull, without having to change permissions every single time?







      share|improve this question














      I have set up a git server, but I'm having some problems with users pushing their commits. I have a total of 3 users, but if any one of them pushes some files, they become read-only for the other users, and the unpacker fails if they try to push.



      I can temporarily fix this issue by recursively setting all permissions to 777 but that is a terrible approach and only fixes it until the next push.



      How can I make it so that all selected users can both push and pull, without having to change permissions every single time?









      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 14 at 20:13









      Michael Homer

      42.4k6108148




      42.4k6108148










      asked Mar 14 at 20:04









      user2894959

      111




      111




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Create your repository with git init --shared, which will:




          Specify that the Git repository is to be shared amongst several users. This allows users belonging to the same group to push into that repository. When specified, the config variable "core.sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions.




          Put all the users who should have write access into the same group, and Git (including the various SSH and smart server elements) will create the files group-writable and g+sx. You may want to create a special group to use for that and chgrp -R the repository to it.



          This will also enable the receive.denyNonFastForwards setting on the repository, which you can disable manually if required.






          share|improve this answer




















          • All the users are in the git group, the permissions bits are g+sx on all files, but pushing still fials with: Already up-to-date. Pushing to mariusz@CENSORED:/srv/git/website.git remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To mariusz@CENSORED:/srv/git/website.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'mariusz@CENSORED:/srv/git/website.git'
            – user2894959
            Mar 14 at 20:39











          • Create the repository in the first place with --shared, don't try to fake it. It does a bit of work behind the scenes.
            – Michael Homer
            Mar 14 at 20:44










          • So the only option is to re-create it?
            – user2894959
            Mar 14 at 20:45










          • It's not the only option, of course, but it's the sensible one. It's git, all copies are the same, you don't lose anything.
            – Michael Homer
            Mar 14 at 20:46










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f430250%2fhow-do-i-make-a-git-server-accessible-to-multiple-users%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          Create your repository with git init --shared, which will:




          Specify that the Git repository is to be shared amongst several users. This allows users belonging to the same group to push into that repository. When specified, the config variable "core.sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions.




          Put all the users who should have write access into the same group, and Git (including the various SSH and smart server elements) will create the files group-writable and g+sx. You may want to create a special group to use for that and chgrp -R the repository to it.



          This will also enable the receive.denyNonFastForwards setting on the repository, which you can disable manually if required.






          share|improve this answer




















          • All the users are in the git group, the permissions bits are g+sx on all files, but pushing still fials with: Already up-to-date. Pushing to mariusz@CENSORED:/srv/git/website.git remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To mariusz@CENSORED:/srv/git/website.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'mariusz@CENSORED:/srv/git/website.git'
            – user2894959
            Mar 14 at 20:39











          • Create the repository in the first place with --shared, don't try to fake it. It does a bit of work behind the scenes.
            – Michael Homer
            Mar 14 at 20:44










          • So the only option is to re-create it?
            – user2894959
            Mar 14 at 20:45










          • It's not the only option, of course, but it's the sensible one. It's git, all copies are the same, you don't lose anything.
            – Michael Homer
            Mar 14 at 20:46














          up vote
          1
          down vote













          Create your repository with git init --shared, which will:




          Specify that the Git repository is to be shared amongst several users. This allows users belonging to the same group to push into that repository. When specified, the config variable "core.sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions.




          Put all the users who should have write access into the same group, and Git (including the various SSH and smart server elements) will create the files group-writable and g+sx. You may want to create a special group to use for that and chgrp -R the repository to it.



          This will also enable the receive.denyNonFastForwards setting on the repository, which you can disable manually if required.






          share|improve this answer




















          • All the users are in the git group, the permissions bits are g+sx on all files, but pushing still fials with: Already up-to-date. Pushing to mariusz@CENSORED:/srv/git/website.git remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To mariusz@CENSORED:/srv/git/website.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'mariusz@CENSORED:/srv/git/website.git'
            – user2894959
            Mar 14 at 20:39











          • Create the repository in the first place with --shared, don't try to fake it. It does a bit of work behind the scenes.
            – Michael Homer
            Mar 14 at 20:44










          • So the only option is to re-create it?
            – user2894959
            Mar 14 at 20:45










          • It's not the only option, of course, but it's the sensible one. It's git, all copies are the same, you don't lose anything.
            – Michael Homer
            Mar 14 at 20:46












          up vote
          1
          down vote










          up vote
          1
          down vote









          Create your repository with git init --shared, which will:




          Specify that the Git repository is to be shared amongst several users. This allows users belonging to the same group to push into that repository. When specified, the config variable "core.sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions.




          Put all the users who should have write access into the same group, and Git (including the various SSH and smart server elements) will create the files group-writable and g+sx. You may want to create a special group to use for that and chgrp -R the repository to it.



          This will also enable the receive.denyNonFastForwards setting on the repository, which you can disable manually if required.






          share|improve this answer












          Create your repository with git init --shared, which will:




          Specify that the Git repository is to be shared amongst several users. This allows users belonging to the same group to push into that repository. When specified, the config variable "core.sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions.




          Put all the users who should have write access into the same group, and Git (including the various SSH and smart server elements) will create the files group-writable and g+sx. You may want to create a special group to use for that and chgrp -R the repository to it.



          This will also enable the receive.denyNonFastForwards setting on the repository, which you can disable manually if required.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 14 at 20:13









          Michael Homer

          42.4k6108148




          42.4k6108148











          • All the users are in the git group, the permissions bits are g+sx on all files, but pushing still fials with: Already up-to-date. Pushing to mariusz@CENSORED:/srv/git/website.git remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To mariusz@CENSORED:/srv/git/website.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'mariusz@CENSORED:/srv/git/website.git'
            – user2894959
            Mar 14 at 20:39











          • Create the repository in the first place with --shared, don't try to fake it. It does a bit of work behind the scenes.
            – Michael Homer
            Mar 14 at 20:44










          • So the only option is to re-create it?
            – user2894959
            Mar 14 at 20:45










          • It's not the only option, of course, but it's the sensible one. It's git, all copies are the same, you don't lose anything.
            – Michael Homer
            Mar 14 at 20:46
















          • All the users are in the git group, the permissions bits are g+sx on all files, but pushing still fials with: Already up-to-date. Pushing to mariusz@CENSORED:/srv/git/website.git remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To mariusz@CENSORED:/srv/git/website.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'mariusz@CENSORED:/srv/git/website.git'
            – user2894959
            Mar 14 at 20:39











          • Create the repository in the first place with --shared, don't try to fake it. It does a bit of work behind the scenes.
            – Michael Homer
            Mar 14 at 20:44










          • So the only option is to re-create it?
            – user2894959
            Mar 14 at 20:45










          • It's not the only option, of course, but it's the sensible one. It's git, all copies are the same, you don't lose anything.
            – Michael Homer
            Mar 14 at 20:46















          All the users are in the git group, the permissions bits are g+sx on all files, but pushing still fials with: Already up-to-date. Pushing to mariusz@CENSORED:/srv/git/website.git remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To mariusz@CENSORED:/srv/git/website.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'mariusz@CENSORED:/srv/git/website.git'
          – user2894959
          Mar 14 at 20:39





          All the users are in the git group, the permissions bits are g+sx on all files, but pushing still fials with: Already up-to-date. Pushing to mariusz@CENSORED:/srv/git/website.git remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object error: unpack failed: unpack-objects abnormal exit To mariusz@CENSORED:/srv/git/website.git ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'mariusz@CENSORED:/srv/git/website.git'
          – user2894959
          Mar 14 at 20:39













          Create the repository in the first place with --shared, don't try to fake it. It does a bit of work behind the scenes.
          – Michael Homer
          Mar 14 at 20:44




          Create the repository in the first place with --shared, don't try to fake it. It does a bit of work behind the scenes.
          – Michael Homer
          Mar 14 at 20:44












          So the only option is to re-create it?
          – user2894959
          Mar 14 at 20:45




          So the only option is to re-create it?
          – user2894959
          Mar 14 at 20:45












          It's not the only option, of course, but it's the sensible one. It's git, all copies are the same, you don't lose anything.
          – Michael Homer
          Mar 14 at 20:46




          It's not the only option, of course, but it's the sensible one. It's git, all copies are the same, you don't lose anything.
          – Michael Homer
          Mar 14 at 20:46












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f430250%2fhow-do-i-make-a-git-server-accessible-to-multiple-users%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?