Git Push Error: insufficient permission for adding an object to repository database












496















When I try to push to a shared git remote, I get the following error:
insufficient permission for adding an object to repository database



Then I read about a fix here: Fix This worked for the next push, since all of the files were of the correct group, but the next time someone pushed up a change it made a new item in the objects folder that had their default group as the group. The only thing I can think of is to change all of the developer's default group for items they check in, but that seems like a hack. Any ideas? Thanks.










share|improve this question























  • I got this error after accidentally git add and git commit-ing as root user. I fixed it with a git reset and this question's answer to fix the .git directory permissions.

    – StockB
    Jun 14 '16 at 18:54











  • How can I find out which object it was trying to create (when manually debugging such permission problems)? The error message is much too vague.

    – mirabilos
    Mar 15 '17 at 14:30
















496















When I try to push to a shared git remote, I get the following error:
insufficient permission for adding an object to repository database



Then I read about a fix here: Fix This worked for the next push, since all of the files were of the correct group, but the next time someone pushed up a change it made a new item in the objects folder that had their default group as the group. The only thing I can think of is to change all of the developer's default group for items they check in, but that seems like a hack. Any ideas? Thanks.










share|improve this question























  • I got this error after accidentally git add and git commit-ing as root user. I fixed it with a git reset and this question's answer to fix the .git directory permissions.

    – StockB
    Jun 14 '16 at 18:54











  • How can I find out which object it was trying to create (when manually debugging such permission problems)? The error message is much too vague.

    – mirabilos
    Mar 15 '17 at 14:30














496












496








496


214






When I try to push to a shared git remote, I get the following error:
insufficient permission for adding an object to repository database



Then I read about a fix here: Fix This worked for the next push, since all of the files were of the correct group, but the next time someone pushed up a change it made a new item in the objects folder that had their default group as the group. The only thing I can think of is to change all of the developer's default group for items they check in, but that seems like a hack. Any ideas? Thanks.










share|improve this question














When I try to push to a shared git remote, I get the following error:
insufficient permission for adding an object to repository database



Then I read about a fix here: Fix This worked for the next push, since all of the files were of the correct group, but the next time someone pushed up a change it made a new item in the objects folder that had their default group as the group. The only thing I can think of is to change all of the developer's default group for items they check in, but that seems like a hack. Any ideas? Thanks.







git push






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 23 '11 at 0:58









skazskaz

10.3k165790




10.3k165790













  • I got this error after accidentally git add and git commit-ing as root user. I fixed it with a git reset and this question's answer to fix the .git directory permissions.

    – StockB
    Jun 14 '16 at 18:54











  • How can I find out which object it was trying to create (when manually debugging such permission problems)? The error message is much too vague.

    – mirabilos
    Mar 15 '17 at 14:30



















  • I got this error after accidentally git add and git commit-ing as root user. I fixed it with a git reset and this question's answer to fix the .git directory permissions.

    – StockB
    Jun 14 '16 at 18:54











  • How can I find out which object it was trying to create (when manually debugging such permission problems)? The error message is much too vague.

    – mirabilos
    Mar 15 '17 at 14:30

















I got this error after accidentally git add and git commit-ing as root user. I fixed it with a git reset and this question's answer to fix the .git directory permissions.

– StockB
Jun 14 '16 at 18:54





I got this error after accidentally git add and git commit-ing as root user. I fixed it with a git reset and this question's answer to fix the .git directory permissions.

– StockB
Jun 14 '16 at 18:54













How can I find out which object it was trying to create (when manually debugging such permission problems)? The error message is much too vague.

– mirabilos
Mar 15 '17 at 14:30





How can I find out which object it was trying to create (when manually debugging such permission problems)? The error message is much too vague.

– mirabilos
Mar 15 '17 at 14:30












15 Answers
15






active

oldest

votes


















740





+50









Repair Permissions



After you have identified and fixed the underlying cause (see below), you'll want to repair the permissions:



cd /path/to/repo.git
sudo chgrp -R groupname .
sudo chmod -R g+rwX .
find . -type d -exec chmod g+s '{}' +


Note if you want everyone to be able to modify the repository, you don't need the chgrp and you will want to change the chmod to sudo chmod -R a+rwX .



If you do not fix the underlying cause, the error will keep coming back and you'll have to keep re-running the above commands over and over again.



Underlying Causes



The error could be caused by one of the following:





  • The repository isn't configured to be a shared repository (see core.sharedRepository in git help config). If the output of:



    git config core.sharedRepository


    is not group or true or 1 or some mask, try running:



    git config core.sharedRepository group


    and then re-run the recursive chmod and chgrp (see "Repair Permissions" above).




  • The operating system doesn't interpret a setgid bit on directories as "all new files and subdirectories should inherit the group owner".



    When core.sharedRepository is true or group, Git relies on a feature of GNU operating systems (e.g., every Linux distribution) to ensure that newly created subdirectories are owned by the correct group (the group that all of the repository's users are in). This feature is documented in the GNU coreutils documentation:




    ... [If] a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. ... [This mechanism lets] users share files more easily, by lessening the need to use chmod or chown to share new files.




    However, not all operating systems have this feature (NetBSD is one example). For those operating systems, you should make sure that all of your Git users have the same default group. Alternatively, you can make the repository world-writable by running git config core.sharedRepository world (but be careful—this is less secure).



  • The file system doesn't support the setgid bit (e.g., FAT). ext2, ext3, ext4 all support the setgid bit. As far as I know, the file systems that don't support the setgid bit also don't support the concept of group ownership so all files and directories will be owned by the same group anyway (which group is a mount option). In this case, make sure all Git users are in the group that owns all the files in the file system.

  • Not all of the Git users are in the same group that owns the repository directories. Make sure the group owner on the directories is correct and that all users are in that group.






share|improve this answer





















  • 1





    @Richard Hansen - I don't really know what you mean by forcing the ownership. I'm looking at the man for chmod but don't know enough about this to have the words make sense :) Any tips?

    – skaz
    Jun 23 '11 at 2:08






  • 4





    @GiH: You will get nothing if it is unset (which is the same as false or umask). See git help config for more details.

    – Richard Hansen
    Aug 2 '12 at 4:22






  • 9





    I must had issued git push using root account in my working directory. I found the owner of some git repository files is root (-r--r--r--. 1 root root 6380 5月 25 12:39 9b44bd22f81b9a8d0a244fd16f7787a1b1d424) according this answer.

    – LiuYan 刘研
    Jun 6 '13 at 5:09








  • 2





    @MattBrowne: Note that it's a capital X, not a lowercase x. A capital X means "set S_IXGRP if the file is a directory (or if any other S_IX* bit is set)", so it won't make all files executable. It may be unnecessary, but maybe not if core.sharedRepository was set to 0600 at some point in the past.

    – Richard Hansen
    May 30 '14 at 21:37






  • 1





    @francoisromain: That line sets the setgid bit on all of the directories. See gnu.org/software/coreutils/manual/html_node/…

    – Richard Hansen
    May 11 '17 at 21:02



















361














For Ubuntu (or any Linux)



From project root,



cd .git/objects
ls -al
sudo chown -R yourname:yourgroup *


You can tell what yourname and yourgroup should be by looking at the permissions on the majority of the output from that ls -al command



Note: remember the star at the end of the sudo line






share|improve this answer



















  • 13





    Thanks man! :) This did the job for me.

    – Woppi
    May 29 '13 at 7:52






  • 7





    Worked great! Yes, for some reason some of the folders were assigned a different name and group (root).

    – Peter Arandorenko
    Jun 17 '14 at 18:57






  • 2





    I get: Sorry, user myuser is not allowed to execute '/bin/chown

    – Francisco Corrales Morales
    Jun 23 '14 at 22:03






  • 2





    awesome, works perfectly

    – steven iseki
    Jul 8 '15 at 2:45






  • 5





    My problem was I had once done a "git pull" as root, which I think screwed up the permissions...you can check by doing an ls .git

    – rogerdpack
    Jul 23 '15 at 13:46



















36














sudo chmod -R ug+w .;



Basically, .git/objects file does not have write permissions. The above line grants permission to all the files and folders in the directory.






share|improve this answer





















  • 1





    This is what worked for me. The accepted answer sadly didn't. Thanks Rajendra!

    – revelt
    Nov 30 '16 at 17:33



















28














I just wanted to add my solution. I had a repo on OS X that had ownership of root on some directories and Home (which is my user directory) on others which caused the same error listed above.



The solution was simple thankfully. From terminal:



sudo chown -R Home projectdirectory





share|improve this answer
























  • Same thing happened to me. I can't figure out how some of the objects got root ownership, but they did.

    – vy32
    Jun 9 '14 at 2:05











  • this was awesome

    – steven iseki
    Nov 27 '15 at 0:44



















16














A good way to debug this is the next time it happens, SSH into the remote repo, cd into the objects folder and do an ls -al.



If you see 2-3 files with different user:group ownership than this is the problem.



It's happened to me in the past with some legacy scripts access our git repo and usually means a different (unix) user pushed / modified files last and your user doesn't have permissions to overwrite those files. You should create a shared git group that all git-enabled users are in and then recursively chgrp the objects folder and it's contents so that it's group ownership is the shared git group.



You should also add a sticky bit on the folder so that all the files created in the folder will always have the group of git.




chmod g+s directory-name




Update: I didn't know about core.sharedRepository. Good to know, though it probably just does the above.






share|improve this answer

































    12














    use the following command, works like magic



    sudo chown -R "${USER:-$(id -un)}" .


    type the command exactly as it is (with extra spaces and one dot at the end)






    share|improve this answer
























    • Works like a charm!

      – doncadavona
      Oct 12 '18 at 3:19











    • awesome! worked perfectly on my mac

      – Sachin Khot
      Jan 9 at 13:45



















    11














    Solved for me...
    just this:



    sudo chmod 777 -R .git/objects





    share|improve this answer





















    • 21





      Chmod 777 isn't recommended as it exposes all of your file to the rest of the world making your machine vulnerable

      – Elena
      Oct 19 '15 at 12:27






    • 23





      If your advice is chmod 777, 99 times out of 100 you do not understand the issue and you are likely to cause more problems than you help solve. As the accepted answer above shows, this issue is no different.

      – jonatan
      Oct 27 '15 at 14:45











    • Why do you guys do not propose an acceptable answer instead say that's a wrong choice?

      – Giovani
      Mar 9 '17 at 16:28








    • 2





      Because even though there are acceptable answers on the page, this unacceptable answer is still here.

      – Teh JoE
      Aug 24 '17 at 16:00











    • sudo chmod -R 777 .git/objects

      – Nabeel Ahmed
      Apr 9 '18 at 9:31



















    9














    This can easily happen if you ran git init with a different user from the one you are planning to use when pushing changes.



    If you blindly follow the instructions on [1] this will happen as you probably created the git-user as root and then immediately moved on to git init without changing user in between.



    [1] http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server






    share|improve this answer































      5














      After you add some stuff... commit them and after all finished push it! BANG!! Start all problems... As you should notice there are some differences in the way both new and existent projects were defined. If some other person tries to add/commit/push same files, or content (git keep both as same objects), we will face the following error:



      $ git push
      Counting objects: 31, done.
      Delta compression using up to 2 threads.
      Compressing objects: 100% (17/17), done.
      Writing objects: 100% (21/21), 2.07 KiB | 0 bytes/s, done.
      Total 21 (delta 12), reused 0 (delta 0)
      remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object


      To solve this problem you have to have something in mind operational system's permissions system as you are restricted by it in this case. Tu understand better the problem, go ahead and check your git object's folder (.git/objects). You will probably see something like that:



      <your user_name>@<the machine name> objects]$ ls -la
      total 200
      drwxr-xr-x 25 <your user_name> <group_name> 2048 Feb 10 09:28 .
      drwxr-xr-x 3 <his user_name> <group_name> 1024 Feb 3 15:06 ..
      drwxr-xr-x 2 <his user_name> <group_name> 1024 Jan 31 13:39 02
      drwxr-xr-x 2 <his user_name> <group_name> 1024 Feb 3 13:24 08


      *Note that those file's permissions were granted only for your users, no one will never can changed it... *



      Level       u   g   o
      Permission rwx r-x ---
      Binary 111 101 000
      Octal 7 5 0


      SOLVING THE PROBLEM



      If you have super user permission, you can go forward and change all permissions by yourself using the step two, in any-other case you will need to ask all users with objects created with their users, use the following command to know who they are:



      $ ls -la | awk '{print $3}' | sort -u 
      <your user_name>
      <his user_name>


      Now you and all file's owner users will have to change those files permission, doing:



      $ chmod -R 774 .


      After that you will need to add a new property that is equivalent to --shared=group done for the new repository, according to the documentation, this make the repository group-writable, do it executing:



      $ git config core.sharedRepository group


      https://coderwall.com/p/8b3ksg






      share|improve this answer
























      • I had all the same username:groupname for mine, but when I tried chmod -R 774 ., I could then run git add --all successfully.

        – John Skilbeck
        Jul 15 '15 at 20:32



















      4














      Linux, macOS:



      cd .git/
      sudo chown -R name:group *


      where name is your username and group is the group that your username belongs to.






      share|improve this answer































        3














        For my case none of the suggestions worked. I'm on Windows and this worked for me:




        • Copy the remote repo into another folder

        • Share the folder and give appropriate permissions.

        • Make sure you can access the folder from your local machine.

        • Add this repo as another remote repo in your local repo. (git remote add foo //SERVERNAME/path/to/copied/git)

        • Push to foo. git push foo master. Did it worked? Great! Now delete not-working repo and rename this into whatever it was before. Make sure permissions and share property remains the same.






        share|improve this answer



















        • 1





          In my case, simply copying the local folder to a new folder, deleting the old one, and renaming the new one to the old name fixed the permissions issues.

          – mgiuffrida
          Jan 30 '17 at 21:33



















        2














        I hit this same issue. Reading around here I realised it was file permissions the message was referring to. The fix , for me, was in:



        /etc/inetd.d/git-gpv



        It was starting git-daemon as user 'nobody' so lacked the write permission.



        # Who   When    What
        # GPV 20Nov13 Created this by hand while reading: http://linuxclues.blogspot.co.uk/2013/06>/git-daemon-ssh-create-repository-debian.html
        # GPV 20Nov13 Changed owner (to user_git) otherise nobody lack permission to update the repository
        #git stream tcp nowait nobody /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo
        git stream tcp nowait user_git /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo


        (I doubt other call their inetd conf file git-gpv . Commonly it would be directly in /etc/inetd.conf)






        share|improve this answer































          1














          You need the sufficient write permissions on the directory that you are pushing to.



          In my case: Windows 2008 server



          right click on git repo directory or parent directory.



          Properties > Sharing tab > Advanced Sharing > Permissions > make sure the user has appropriate access rights.






          share|improve this answer































            1














            You may have accidentally nested git repositories






            share|improve this answer

































              1














              There is a possibility also that you added another local repository with the same alias. As an example, you now have 2 local folders referred to as origin so when you try to push, the remote repository will not accept you credentials.



              Rename the local repository aliases, you can follow this link https://stackoverflow.com/a/26651835/2270348



              Maybe you can leave 1 local repository of your liking as origin and the others rename them for example from origin to anotherorigin. Remember these are just aliases and all you need to do is remember the new aliases and their respective remote branches.






              share|improve this answer






















                protected by zero323 Dec 23 '15 at 6:58



                Thank you for your interest in this question.
                Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                Would you like to answer one of these unanswered questions instead?














                15 Answers
                15






                active

                oldest

                votes








                15 Answers
                15






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                740





                +50









                Repair Permissions



                After you have identified and fixed the underlying cause (see below), you'll want to repair the permissions:



                cd /path/to/repo.git
                sudo chgrp -R groupname .
                sudo chmod -R g+rwX .
                find . -type d -exec chmod g+s '{}' +


                Note if you want everyone to be able to modify the repository, you don't need the chgrp and you will want to change the chmod to sudo chmod -R a+rwX .



                If you do not fix the underlying cause, the error will keep coming back and you'll have to keep re-running the above commands over and over again.



                Underlying Causes



                The error could be caused by one of the following:





                • The repository isn't configured to be a shared repository (see core.sharedRepository in git help config). If the output of:



                  git config core.sharedRepository


                  is not group or true or 1 or some mask, try running:



                  git config core.sharedRepository group


                  and then re-run the recursive chmod and chgrp (see "Repair Permissions" above).




                • The operating system doesn't interpret a setgid bit on directories as "all new files and subdirectories should inherit the group owner".



                  When core.sharedRepository is true or group, Git relies on a feature of GNU operating systems (e.g., every Linux distribution) to ensure that newly created subdirectories are owned by the correct group (the group that all of the repository's users are in). This feature is documented in the GNU coreutils documentation:




                  ... [If] a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. ... [This mechanism lets] users share files more easily, by lessening the need to use chmod or chown to share new files.




                  However, not all operating systems have this feature (NetBSD is one example). For those operating systems, you should make sure that all of your Git users have the same default group. Alternatively, you can make the repository world-writable by running git config core.sharedRepository world (but be careful—this is less secure).



                • The file system doesn't support the setgid bit (e.g., FAT). ext2, ext3, ext4 all support the setgid bit. As far as I know, the file systems that don't support the setgid bit also don't support the concept of group ownership so all files and directories will be owned by the same group anyway (which group is a mount option). In this case, make sure all Git users are in the group that owns all the files in the file system.

                • Not all of the Git users are in the same group that owns the repository directories. Make sure the group owner on the directories is correct and that all users are in that group.






                share|improve this answer





















                • 1





                  @Richard Hansen - I don't really know what you mean by forcing the ownership. I'm looking at the man for chmod but don't know enough about this to have the words make sense :) Any tips?

                  – skaz
                  Jun 23 '11 at 2:08






                • 4





                  @GiH: You will get nothing if it is unset (which is the same as false or umask). See git help config for more details.

                  – Richard Hansen
                  Aug 2 '12 at 4:22






                • 9





                  I must had issued git push using root account in my working directory. I found the owner of some git repository files is root (-r--r--r--. 1 root root 6380 5月 25 12:39 9b44bd22f81b9a8d0a244fd16f7787a1b1d424) according this answer.

                  – LiuYan 刘研
                  Jun 6 '13 at 5:09








                • 2





                  @MattBrowne: Note that it's a capital X, not a lowercase x. A capital X means "set S_IXGRP if the file is a directory (or if any other S_IX* bit is set)", so it won't make all files executable. It may be unnecessary, but maybe not if core.sharedRepository was set to 0600 at some point in the past.

                  – Richard Hansen
                  May 30 '14 at 21:37






                • 1





                  @francoisromain: That line sets the setgid bit on all of the directories. See gnu.org/software/coreutils/manual/html_node/…

                  – Richard Hansen
                  May 11 '17 at 21:02
















                740





                +50









                Repair Permissions



                After you have identified and fixed the underlying cause (see below), you'll want to repair the permissions:



                cd /path/to/repo.git
                sudo chgrp -R groupname .
                sudo chmod -R g+rwX .
                find . -type d -exec chmod g+s '{}' +


                Note if you want everyone to be able to modify the repository, you don't need the chgrp and you will want to change the chmod to sudo chmod -R a+rwX .



                If you do not fix the underlying cause, the error will keep coming back and you'll have to keep re-running the above commands over and over again.



                Underlying Causes



                The error could be caused by one of the following:





                • The repository isn't configured to be a shared repository (see core.sharedRepository in git help config). If the output of:



                  git config core.sharedRepository


                  is not group or true or 1 or some mask, try running:



                  git config core.sharedRepository group


                  and then re-run the recursive chmod and chgrp (see "Repair Permissions" above).




                • The operating system doesn't interpret a setgid bit on directories as "all new files and subdirectories should inherit the group owner".



                  When core.sharedRepository is true or group, Git relies on a feature of GNU operating systems (e.g., every Linux distribution) to ensure that newly created subdirectories are owned by the correct group (the group that all of the repository's users are in). This feature is documented in the GNU coreutils documentation:




                  ... [If] a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. ... [This mechanism lets] users share files more easily, by lessening the need to use chmod or chown to share new files.




                  However, not all operating systems have this feature (NetBSD is one example). For those operating systems, you should make sure that all of your Git users have the same default group. Alternatively, you can make the repository world-writable by running git config core.sharedRepository world (but be careful—this is less secure).



                • The file system doesn't support the setgid bit (e.g., FAT). ext2, ext3, ext4 all support the setgid bit. As far as I know, the file systems that don't support the setgid bit also don't support the concept of group ownership so all files and directories will be owned by the same group anyway (which group is a mount option). In this case, make sure all Git users are in the group that owns all the files in the file system.

                • Not all of the Git users are in the same group that owns the repository directories. Make sure the group owner on the directories is correct and that all users are in that group.






                share|improve this answer





















                • 1





                  @Richard Hansen - I don't really know what you mean by forcing the ownership. I'm looking at the man for chmod but don't know enough about this to have the words make sense :) Any tips?

                  – skaz
                  Jun 23 '11 at 2:08






                • 4





                  @GiH: You will get nothing if it is unset (which is the same as false or umask). See git help config for more details.

                  – Richard Hansen
                  Aug 2 '12 at 4:22






                • 9





                  I must had issued git push using root account in my working directory. I found the owner of some git repository files is root (-r--r--r--. 1 root root 6380 5月 25 12:39 9b44bd22f81b9a8d0a244fd16f7787a1b1d424) according this answer.

                  – LiuYan 刘研
                  Jun 6 '13 at 5:09








                • 2





                  @MattBrowne: Note that it's a capital X, not a lowercase x. A capital X means "set S_IXGRP if the file is a directory (or if any other S_IX* bit is set)", so it won't make all files executable. It may be unnecessary, but maybe not if core.sharedRepository was set to 0600 at some point in the past.

                  – Richard Hansen
                  May 30 '14 at 21:37






                • 1





                  @francoisromain: That line sets the setgid bit on all of the directories. See gnu.org/software/coreutils/manual/html_node/…

                  – Richard Hansen
                  May 11 '17 at 21:02














                740





                +50







                740





                +50



                740




                +50





                Repair Permissions



                After you have identified and fixed the underlying cause (see below), you'll want to repair the permissions:



                cd /path/to/repo.git
                sudo chgrp -R groupname .
                sudo chmod -R g+rwX .
                find . -type d -exec chmod g+s '{}' +


                Note if you want everyone to be able to modify the repository, you don't need the chgrp and you will want to change the chmod to sudo chmod -R a+rwX .



                If you do not fix the underlying cause, the error will keep coming back and you'll have to keep re-running the above commands over and over again.



                Underlying Causes



                The error could be caused by one of the following:





                • The repository isn't configured to be a shared repository (see core.sharedRepository in git help config). If the output of:



                  git config core.sharedRepository


                  is not group or true or 1 or some mask, try running:



                  git config core.sharedRepository group


                  and then re-run the recursive chmod and chgrp (see "Repair Permissions" above).




                • The operating system doesn't interpret a setgid bit on directories as "all new files and subdirectories should inherit the group owner".



                  When core.sharedRepository is true or group, Git relies on a feature of GNU operating systems (e.g., every Linux distribution) to ensure that newly created subdirectories are owned by the correct group (the group that all of the repository's users are in). This feature is documented in the GNU coreutils documentation:




                  ... [If] a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. ... [This mechanism lets] users share files more easily, by lessening the need to use chmod or chown to share new files.




                  However, not all operating systems have this feature (NetBSD is one example). For those operating systems, you should make sure that all of your Git users have the same default group. Alternatively, you can make the repository world-writable by running git config core.sharedRepository world (but be careful—this is less secure).



                • The file system doesn't support the setgid bit (e.g., FAT). ext2, ext3, ext4 all support the setgid bit. As far as I know, the file systems that don't support the setgid bit also don't support the concept of group ownership so all files and directories will be owned by the same group anyway (which group is a mount option). In this case, make sure all Git users are in the group that owns all the files in the file system.

                • Not all of the Git users are in the same group that owns the repository directories. Make sure the group owner on the directories is correct and that all users are in that group.






                share|improve this answer















                Repair Permissions



                After you have identified and fixed the underlying cause (see below), you'll want to repair the permissions:



                cd /path/to/repo.git
                sudo chgrp -R groupname .
                sudo chmod -R g+rwX .
                find . -type d -exec chmod g+s '{}' +


                Note if you want everyone to be able to modify the repository, you don't need the chgrp and you will want to change the chmod to sudo chmod -R a+rwX .



                If you do not fix the underlying cause, the error will keep coming back and you'll have to keep re-running the above commands over and over again.



                Underlying Causes



                The error could be caused by one of the following:





                • The repository isn't configured to be a shared repository (see core.sharedRepository in git help config). If the output of:



                  git config core.sharedRepository


                  is not group or true or 1 or some mask, try running:



                  git config core.sharedRepository group


                  and then re-run the recursive chmod and chgrp (see "Repair Permissions" above).




                • The operating system doesn't interpret a setgid bit on directories as "all new files and subdirectories should inherit the group owner".



                  When core.sharedRepository is true or group, Git relies on a feature of GNU operating systems (e.g., every Linux distribution) to ensure that newly created subdirectories are owned by the correct group (the group that all of the repository's users are in). This feature is documented in the GNU coreutils documentation:




                  ... [If] a directory's set-group-ID bit is set, newly created subfiles inherit the same group as the directory, and newly created subdirectories inherit the set-group-ID bit of the parent directory. ... [This mechanism lets] users share files more easily, by lessening the need to use chmod or chown to share new files.




                  However, not all operating systems have this feature (NetBSD is one example). For those operating systems, you should make sure that all of your Git users have the same default group. Alternatively, you can make the repository world-writable by running git config core.sharedRepository world (but be careful—this is less secure).



                • The file system doesn't support the setgid bit (e.g., FAT). ext2, ext3, ext4 all support the setgid bit. As far as I know, the file systems that don't support the setgid bit also don't support the concept of group ownership so all files and directories will be owned by the same group anyway (which group is a mount option). In this case, make sure all Git users are in the group that owns all the files in the file system.

                • Not all of the Git users are in the same group that owns the repository directories. Make sure the group owner on the directories is correct and that all users are in that group.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Aug 28 '18 at 17:58









                Seth Robertson

                23.7k24746




                23.7k24746










                answered Jun 23 '11 at 1:13









                Richard HansenRichard Hansen

                33.8k167483




                33.8k167483








                • 1





                  @Richard Hansen - I don't really know what you mean by forcing the ownership. I'm looking at the man for chmod but don't know enough about this to have the words make sense :) Any tips?

                  – skaz
                  Jun 23 '11 at 2:08






                • 4





                  @GiH: You will get nothing if it is unset (which is the same as false or umask). See git help config for more details.

                  – Richard Hansen
                  Aug 2 '12 at 4:22






                • 9





                  I must had issued git push using root account in my working directory. I found the owner of some git repository files is root (-r--r--r--. 1 root root 6380 5月 25 12:39 9b44bd22f81b9a8d0a244fd16f7787a1b1d424) according this answer.

                  – LiuYan 刘研
                  Jun 6 '13 at 5:09








                • 2





                  @MattBrowne: Note that it's a capital X, not a lowercase x. A capital X means "set S_IXGRP if the file is a directory (or if any other S_IX* bit is set)", so it won't make all files executable. It may be unnecessary, but maybe not if core.sharedRepository was set to 0600 at some point in the past.

                  – Richard Hansen
                  May 30 '14 at 21:37






                • 1





                  @francoisromain: That line sets the setgid bit on all of the directories. See gnu.org/software/coreutils/manual/html_node/…

                  – Richard Hansen
                  May 11 '17 at 21:02














                • 1





                  @Richard Hansen - I don't really know what you mean by forcing the ownership. I'm looking at the man for chmod but don't know enough about this to have the words make sense :) Any tips?

                  – skaz
                  Jun 23 '11 at 2:08






                • 4





                  @GiH: You will get nothing if it is unset (which is the same as false or umask). See git help config for more details.

                  – Richard Hansen
                  Aug 2 '12 at 4:22






                • 9





                  I must had issued git push using root account in my working directory. I found the owner of some git repository files is root (-r--r--r--. 1 root root 6380 5月 25 12:39 9b44bd22f81b9a8d0a244fd16f7787a1b1d424) according this answer.

                  – LiuYan 刘研
                  Jun 6 '13 at 5:09








                • 2





                  @MattBrowne: Note that it's a capital X, not a lowercase x. A capital X means "set S_IXGRP if the file is a directory (or if any other S_IX* bit is set)", so it won't make all files executable. It may be unnecessary, but maybe not if core.sharedRepository was set to 0600 at some point in the past.

                  – Richard Hansen
                  May 30 '14 at 21:37






                • 1





                  @francoisromain: That line sets the setgid bit on all of the directories. See gnu.org/software/coreutils/manual/html_node/…

                  – Richard Hansen
                  May 11 '17 at 21:02








                1




                1





                @Richard Hansen - I don't really know what you mean by forcing the ownership. I'm looking at the man for chmod but don't know enough about this to have the words make sense :) Any tips?

                – skaz
                Jun 23 '11 at 2:08





                @Richard Hansen - I don't really know what you mean by forcing the ownership. I'm looking at the man for chmod but don't know enough about this to have the words make sense :) Any tips?

                – skaz
                Jun 23 '11 at 2:08




                4




                4





                @GiH: You will get nothing if it is unset (which is the same as false or umask). See git help config for more details.

                – Richard Hansen
                Aug 2 '12 at 4:22





                @GiH: You will get nothing if it is unset (which is the same as false or umask). See git help config for more details.

                – Richard Hansen
                Aug 2 '12 at 4:22




                9




                9





                I must had issued git push using root account in my working directory. I found the owner of some git repository files is root (-r--r--r--. 1 root root 6380 5月 25 12:39 9b44bd22f81b9a8d0a244fd16f7787a1b1d424) according this answer.

                – LiuYan 刘研
                Jun 6 '13 at 5:09







                I must had issued git push using root account in my working directory. I found the owner of some git repository files is root (-r--r--r--. 1 root root 6380 5月 25 12:39 9b44bd22f81b9a8d0a244fd16f7787a1b1d424) according this answer.

                – LiuYan 刘研
                Jun 6 '13 at 5:09






                2




                2





                @MattBrowne: Note that it's a capital X, not a lowercase x. A capital X means "set S_IXGRP if the file is a directory (or if any other S_IX* bit is set)", so it won't make all files executable. It may be unnecessary, but maybe not if core.sharedRepository was set to 0600 at some point in the past.

                – Richard Hansen
                May 30 '14 at 21:37





                @MattBrowne: Note that it's a capital X, not a lowercase x. A capital X means "set S_IXGRP if the file is a directory (or if any other S_IX* bit is set)", so it won't make all files executable. It may be unnecessary, but maybe not if core.sharedRepository was set to 0600 at some point in the past.

                – Richard Hansen
                May 30 '14 at 21:37




                1




                1





                @francoisromain: That line sets the setgid bit on all of the directories. See gnu.org/software/coreutils/manual/html_node/…

                – Richard Hansen
                May 11 '17 at 21:02





                @francoisromain: That line sets the setgid bit on all of the directories. See gnu.org/software/coreutils/manual/html_node/…

                – Richard Hansen
                May 11 '17 at 21:02













                361














                For Ubuntu (or any Linux)



                From project root,



                cd .git/objects
                ls -al
                sudo chown -R yourname:yourgroup *


                You can tell what yourname and yourgroup should be by looking at the permissions on the majority of the output from that ls -al command



                Note: remember the star at the end of the sudo line






                share|improve this answer



















                • 13





                  Thanks man! :) This did the job for me.

                  – Woppi
                  May 29 '13 at 7:52






                • 7





                  Worked great! Yes, for some reason some of the folders were assigned a different name and group (root).

                  – Peter Arandorenko
                  Jun 17 '14 at 18:57






                • 2





                  I get: Sorry, user myuser is not allowed to execute '/bin/chown

                  – Francisco Corrales Morales
                  Jun 23 '14 at 22:03






                • 2





                  awesome, works perfectly

                  – steven iseki
                  Jul 8 '15 at 2:45






                • 5





                  My problem was I had once done a "git pull" as root, which I think screwed up the permissions...you can check by doing an ls .git

                  – rogerdpack
                  Jul 23 '15 at 13:46
















                361














                For Ubuntu (or any Linux)



                From project root,



                cd .git/objects
                ls -al
                sudo chown -R yourname:yourgroup *


                You can tell what yourname and yourgroup should be by looking at the permissions on the majority of the output from that ls -al command



                Note: remember the star at the end of the sudo line






                share|improve this answer



















                • 13





                  Thanks man! :) This did the job for me.

                  – Woppi
                  May 29 '13 at 7:52






                • 7





                  Worked great! Yes, for some reason some of the folders were assigned a different name and group (root).

                  – Peter Arandorenko
                  Jun 17 '14 at 18:57






                • 2





                  I get: Sorry, user myuser is not allowed to execute '/bin/chown

                  – Francisco Corrales Morales
                  Jun 23 '14 at 22:03






                • 2





                  awesome, works perfectly

                  – steven iseki
                  Jul 8 '15 at 2:45






                • 5





                  My problem was I had once done a "git pull" as root, which I think screwed up the permissions...you can check by doing an ls .git

                  – rogerdpack
                  Jul 23 '15 at 13:46














                361












                361








                361







                For Ubuntu (or any Linux)



                From project root,



                cd .git/objects
                ls -al
                sudo chown -R yourname:yourgroup *


                You can tell what yourname and yourgroup should be by looking at the permissions on the majority of the output from that ls -al command



                Note: remember the star at the end of the sudo line






                share|improve this answer













                For Ubuntu (or any Linux)



                From project root,



                cd .git/objects
                ls -al
                sudo chown -R yourname:yourgroup *


                You can tell what yourname and yourgroup should be by looking at the permissions on the majority of the output from that ls -al command



                Note: remember the star at the end of the sudo line







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 21 '11 at 13:04









                TerrySTerryS

                4,16411012




                4,16411012








                • 13





                  Thanks man! :) This did the job for me.

                  – Woppi
                  May 29 '13 at 7:52






                • 7





                  Worked great! Yes, for some reason some of the folders were assigned a different name and group (root).

                  – Peter Arandorenko
                  Jun 17 '14 at 18:57






                • 2





                  I get: Sorry, user myuser is not allowed to execute '/bin/chown

                  – Francisco Corrales Morales
                  Jun 23 '14 at 22:03






                • 2





                  awesome, works perfectly

                  – steven iseki
                  Jul 8 '15 at 2:45






                • 5





                  My problem was I had once done a "git pull" as root, which I think screwed up the permissions...you can check by doing an ls .git

                  – rogerdpack
                  Jul 23 '15 at 13:46














                • 13





                  Thanks man! :) This did the job for me.

                  – Woppi
                  May 29 '13 at 7:52






                • 7





                  Worked great! Yes, for some reason some of the folders were assigned a different name and group (root).

                  – Peter Arandorenko
                  Jun 17 '14 at 18:57






                • 2





                  I get: Sorry, user myuser is not allowed to execute '/bin/chown

                  – Francisco Corrales Morales
                  Jun 23 '14 at 22:03






                • 2





                  awesome, works perfectly

                  – steven iseki
                  Jul 8 '15 at 2:45






                • 5





                  My problem was I had once done a "git pull" as root, which I think screwed up the permissions...you can check by doing an ls .git

                  – rogerdpack
                  Jul 23 '15 at 13:46








                13




                13





                Thanks man! :) This did the job for me.

                – Woppi
                May 29 '13 at 7:52





                Thanks man! :) This did the job for me.

                – Woppi
                May 29 '13 at 7:52




                7




                7





                Worked great! Yes, for some reason some of the folders were assigned a different name and group (root).

                – Peter Arandorenko
                Jun 17 '14 at 18:57





                Worked great! Yes, for some reason some of the folders were assigned a different name and group (root).

                – Peter Arandorenko
                Jun 17 '14 at 18:57




                2




                2





                I get: Sorry, user myuser is not allowed to execute '/bin/chown

                – Francisco Corrales Morales
                Jun 23 '14 at 22:03





                I get: Sorry, user myuser is not allowed to execute '/bin/chown

                – Francisco Corrales Morales
                Jun 23 '14 at 22:03




                2




                2





                awesome, works perfectly

                – steven iseki
                Jul 8 '15 at 2:45





                awesome, works perfectly

                – steven iseki
                Jul 8 '15 at 2:45




                5




                5





                My problem was I had once done a "git pull" as root, which I think screwed up the permissions...you can check by doing an ls .git

                – rogerdpack
                Jul 23 '15 at 13:46





                My problem was I had once done a "git pull" as root, which I think screwed up the permissions...you can check by doing an ls .git

                – rogerdpack
                Jul 23 '15 at 13:46











                36














                sudo chmod -R ug+w .;



                Basically, .git/objects file does not have write permissions. The above line grants permission to all the files and folders in the directory.






                share|improve this answer





















                • 1





                  This is what worked for me. The accepted answer sadly didn't. Thanks Rajendra!

                  – revelt
                  Nov 30 '16 at 17:33
















                36














                sudo chmod -R ug+w .;



                Basically, .git/objects file does not have write permissions. The above line grants permission to all the files and folders in the directory.






                share|improve this answer





















                • 1





                  This is what worked for me. The accepted answer sadly didn't. Thanks Rajendra!

                  – revelt
                  Nov 30 '16 at 17:33














                36












                36








                36







                sudo chmod -R ug+w .;



                Basically, .git/objects file does not have write permissions. The above line grants permission to all the files and folders in the directory.






                share|improve this answer















                sudo chmod -R ug+w .;



                Basically, .git/objects file does not have write permissions. The above line grants permission to all the files and folders in the directory.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jun 6 '17 at 0:18









                Henry

                315116




                315116










                answered Dec 23 '15 at 6:40









                Rajendra kumar VankadariRajendra kumar Vankadari

                1,137911




                1,137911








                • 1





                  This is what worked for me. The accepted answer sadly didn't. Thanks Rajendra!

                  – revelt
                  Nov 30 '16 at 17:33














                • 1





                  This is what worked for me. The accepted answer sadly didn't. Thanks Rajendra!

                  – revelt
                  Nov 30 '16 at 17:33








                1




                1





                This is what worked for me. The accepted answer sadly didn't. Thanks Rajendra!

                – revelt
                Nov 30 '16 at 17:33





                This is what worked for me. The accepted answer sadly didn't. Thanks Rajendra!

                – revelt
                Nov 30 '16 at 17:33











                28














                I just wanted to add my solution. I had a repo on OS X that had ownership of root on some directories and Home (which is my user directory) on others which caused the same error listed above.



                The solution was simple thankfully. From terminal:



                sudo chown -R Home projectdirectory





                share|improve this answer
























                • Same thing happened to me. I can't figure out how some of the objects got root ownership, but they did.

                  – vy32
                  Jun 9 '14 at 2:05











                • this was awesome

                  – steven iseki
                  Nov 27 '15 at 0:44
















                28














                I just wanted to add my solution. I had a repo on OS X that had ownership of root on some directories and Home (which is my user directory) on others which caused the same error listed above.



                The solution was simple thankfully. From terminal:



                sudo chown -R Home projectdirectory





                share|improve this answer
























                • Same thing happened to me. I can't figure out how some of the objects got root ownership, but they did.

                  – vy32
                  Jun 9 '14 at 2:05











                • this was awesome

                  – steven iseki
                  Nov 27 '15 at 0:44














                28












                28








                28







                I just wanted to add my solution. I had a repo on OS X that had ownership of root on some directories and Home (which is my user directory) on others which caused the same error listed above.



                The solution was simple thankfully. From terminal:



                sudo chown -R Home projectdirectory





                share|improve this answer













                I just wanted to add my solution. I had a repo on OS X that had ownership of root on some directories and Home (which is my user directory) on others which caused the same error listed above.



                The solution was simple thankfully. From terminal:



                sudo chown -R Home projectdirectory






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 14 '12 at 18:18









                BrandonBrandon

                98521736




                98521736













                • Same thing happened to me. I can't figure out how some of the objects got root ownership, but they did.

                  – vy32
                  Jun 9 '14 at 2:05











                • this was awesome

                  – steven iseki
                  Nov 27 '15 at 0:44



















                • Same thing happened to me. I can't figure out how some of the objects got root ownership, but they did.

                  – vy32
                  Jun 9 '14 at 2:05











                • this was awesome

                  – steven iseki
                  Nov 27 '15 at 0:44

















                Same thing happened to me. I can't figure out how some of the objects got root ownership, but they did.

                – vy32
                Jun 9 '14 at 2:05





                Same thing happened to me. I can't figure out how some of the objects got root ownership, but they did.

                – vy32
                Jun 9 '14 at 2:05













                this was awesome

                – steven iseki
                Nov 27 '15 at 0:44





                this was awesome

                – steven iseki
                Nov 27 '15 at 0:44











                16














                A good way to debug this is the next time it happens, SSH into the remote repo, cd into the objects folder and do an ls -al.



                If you see 2-3 files with different user:group ownership than this is the problem.



                It's happened to me in the past with some legacy scripts access our git repo and usually means a different (unix) user pushed / modified files last and your user doesn't have permissions to overwrite those files. You should create a shared git group that all git-enabled users are in and then recursively chgrp the objects folder and it's contents so that it's group ownership is the shared git group.



                You should also add a sticky bit on the folder so that all the files created in the folder will always have the group of git.




                chmod g+s directory-name




                Update: I didn't know about core.sharedRepository. Good to know, though it probably just does the above.






                share|improve this answer






























                  16














                  A good way to debug this is the next time it happens, SSH into the remote repo, cd into the objects folder and do an ls -al.



                  If you see 2-3 files with different user:group ownership than this is the problem.



                  It's happened to me in the past with some legacy scripts access our git repo and usually means a different (unix) user pushed / modified files last and your user doesn't have permissions to overwrite those files. You should create a shared git group that all git-enabled users are in and then recursively chgrp the objects folder and it's contents so that it's group ownership is the shared git group.



                  You should also add a sticky bit on the folder so that all the files created in the folder will always have the group of git.




                  chmod g+s directory-name




                  Update: I didn't know about core.sharedRepository. Good to know, though it probably just does the above.






                  share|improve this answer




























                    16












                    16








                    16







                    A good way to debug this is the next time it happens, SSH into the remote repo, cd into the objects folder and do an ls -al.



                    If you see 2-3 files with different user:group ownership than this is the problem.



                    It's happened to me in the past with some legacy scripts access our git repo and usually means a different (unix) user pushed / modified files last and your user doesn't have permissions to overwrite those files. You should create a shared git group that all git-enabled users are in and then recursively chgrp the objects folder and it's contents so that it's group ownership is the shared git group.



                    You should also add a sticky bit on the folder so that all the files created in the folder will always have the group of git.




                    chmod g+s directory-name




                    Update: I didn't know about core.sharedRepository. Good to know, though it probably just does the above.






                    share|improve this answer















                    A good way to debug this is the next time it happens, SSH into the remote repo, cd into the objects folder and do an ls -al.



                    If you see 2-3 files with different user:group ownership than this is the problem.



                    It's happened to me in the past with some legacy scripts access our git repo and usually means a different (unix) user pushed / modified files last and your user doesn't have permissions to overwrite those files. You should create a shared git group that all git-enabled users are in and then recursively chgrp the objects folder and it's contents so that it's group ownership is the shared git group.



                    You should also add a sticky bit on the folder so that all the files created in the folder will always have the group of git.




                    chmod g+s directory-name




                    Update: I didn't know about core.sharedRepository. Good to know, though it probably just does the above.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jun 23 '11 at 4:43

























                    answered Jun 23 '11 at 3:49









                    Mauvis LedfordMauvis Ledford

                    25.4k126584




                    25.4k126584























                        12














                        use the following command, works like magic



                        sudo chown -R "${USER:-$(id -un)}" .


                        type the command exactly as it is (with extra spaces and one dot at the end)






                        share|improve this answer
























                        • Works like a charm!

                          – doncadavona
                          Oct 12 '18 at 3:19











                        • awesome! worked perfectly on my mac

                          – Sachin Khot
                          Jan 9 at 13:45
















                        12














                        use the following command, works like magic



                        sudo chown -R "${USER:-$(id -un)}" .


                        type the command exactly as it is (with extra spaces and one dot at the end)






                        share|improve this answer
























                        • Works like a charm!

                          – doncadavona
                          Oct 12 '18 at 3:19











                        • awesome! worked perfectly on my mac

                          – Sachin Khot
                          Jan 9 at 13:45














                        12












                        12








                        12







                        use the following command, works like magic



                        sudo chown -R "${USER:-$(id -un)}" .


                        type the command exactly as it is (with extra spaces and one dot at the end)






                        share|improve this answer













                        use the following command, works like magic



                        sudo chown -R "${USER:-$(id -un)}" .


                        type the command exactly as it is (with extra spaces and one dot at the end)







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Feb 19 '18 at 12:39









                        Code_WormCode_Worm

                        74611017




                        74611017













                        • Works like a charm!

                          – doncadavona
                          Oct 12 '18 at 3:19











                        • awesome! worked perfectly on my mac

                          – Sachin Khot
                          Jan 9 at 13:45



















                        • Works like a charm!

                          – doncadavona
                          Oct 12 '18 at 3:19











                        • awesome! worked perfectly on my mac

                          – Sachin Khot
                          Jan 9 at 13:45

















                        Works like a charm!

                        – doncadavona
                        Oct 12 '18 at 3:19





                        Works like a charm!

                        – doncadavona
                        Oct 12 '18 at 3:19













                        awesome! worked perfectly on my mac

                        – Sachin Khot
                        Jan 9 at 13:45





                        awesome! worked perfectly on my mac

                        – Sachin Khot
                        Jan 9 at 13:45











                        11














                        Solved for me...
                        just this:



                        sudo chmod 777 -R .git/objects





                        share|improve this answer





















                        • 21





                          Chmod 777 isn't recommended as it exposes all of your file to the rest of the world making your machine vulnerable

                          – Elena
                          Oct 19 '15 at 12:27






                        • 23





                          If your advice is chmod 777, 99 times out of 100 you do not understand the issue and you are likely to cause more problems than you help solve. As the accepted answer above shows, this issue is no different.

                          – jonatan
                          Oct 27 '15 at 14:45











                        • Why do you guys do not propose an acceptable answer instead say that's a wrong choice?

                          – Giovani
                          Mar 9 '17 at 16:28








                        • 2





                          Because even though there are acceptable answers on the page, this unacceptable answer is still here.

                          – Teh JoE
                          Aug 24 '17 at 16:00











                        • sudo chmod -R 777 .git/objects

                          – Nabeel Ahmed
                          Apr 9 '18 at 9:31
















                        11














                        Solved for me...
                        just this:



                        sudo chmod 777 -R .git/objects





                        share|improve this answer





















                        • 21





                          Chmod 777 isn't recommended as it exposes all of your file to the rest of the world making your machine vulnerable

                          – Elena
                          Oct 19 '15 at 12:27






                        • 23





                          If your advice is chmod 777, 99 times out of 100 you do not understand the issue and you are likely to cause more problems than you help solve. As the accepted answer above shows, this issue is no different.

                          – jonatan
                          Oct 27 '15 at 14:45











                        • Why do you guys do not propose an acceptable answer instead say that's a wrong choice?

                          – Giovani
                          Mar 9 '17 at 16:28








                        • 2





                          Because even though there are acceptable answers on the page, this unacceptable answer is still here.

                          – Teh JoE
                          Aug 24 '17 at 16:00











                        • sudo chmod -R 777 .git/objects

                          – Nabeel Ahmed
                          Apr 9 '18 at 9:31














                        11












                        11








                        11







                        Solved for me...
                        just this:



                        sudo chmod 777 -R .git/objects





                        share|improve this answer















                        Solved for me...
                        just this:



                        sudo chmod 777 -R .git/objects






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Sep 4 '15 at 10:53









                        Super Chafouin

                        4,04564163




                        4,04564163










                        answered Sep 4 '15 at 10:47









                        GUSTAVO BERBERTGUSTAVO BERBERT

                        26323




                        26323








                        • 21





                          Chmod 777 isn't recommended as it exposes all of your file to the rest of the world making your machine vulnerable

                          – Elena
                          Oct 19 '15 at 12:27






                        • 23





                          If your advice is chmod 777, 99 times out of 100 you do not understand the issue and you are likely to cause more problems than you help solve. As the accepted answer above shows, this issue is no different.

                          – jonatan
                          Oct 27 '15 at 14:45











                        • Why do you guys do not propose an acceptable answer instead say that's a wrong choice?

                          – Giovani
                          Mar 9 '17 at 16:28








                        • 2





                          Because even though there are acceptable answers on the page, this unacceptable answer is still here.

                          – Teh JoE
                          Aug 24 '17 at 16:00











                        • sudo chmod -R 777 .git/objects

                          – Nabeel Ahmed
                          Apr 9 '18 at 9:31














                        • 21





                          Chmod 777 isn't recommended as it exposes all of your file to the rest of the world making your machine vulnerable

                          – Elena
                          Oct 19 '15 at 12:27






                        • 23





                          If your advice is chmod 777, 99 times out of 100 you do not understand the issue and you are likely to cause more problems than you help solve. As the accepted answer above shows, this issue is no different.

                          – jonatan
                          Oct 27 '15 at 14:45











                        • Why do you guys do not propose an acceptable answer instead say that's a wrong choice?

                          – Giovani
                          Mar 9 '17 at 16:28








                        • 2





                          Because even though there are acceptable answers on the page, this unacceptable answer is still here.

                          – Teh JoE
                          Aug 24 '17 at 16:00











                        • sudo chmod -R 777 .git/objects

                          – Nabeel Ahmed
                          Apr 9 '18 at 9:31








                        21




                        21





                        Chmod 777 isn't recommended as it exposes all of your file to the rest of the world making your machine vulnerable

                        – Elena
                        Oct 19 '15 at 12:27





                        Chmod 777 isn't recommended as it exposes all of your file to the rest of the world making your machine vulnerable

                        – Elena
                        Oct 19 '15 at 12:27




                        23




                        23





                        If your advice is chmod 777, 99 times out of 100 you do not understand the issue and you are likely to cause more problems than you help solve. As the accepted answer above shows, this issue is no different.

                        – jonatan
                        Oct 27 '15 at 14:45





                        If your advice is chmod 777, 99 times out of 100 you do not understand the issue and you are likely to cause more problems than you help solve. As the accepted answer above shows, this issue is no different.

                        – jonatan
                        Oct 27 '15 at 14:45













                        Why do you guys do not propose an acceptable answer instead say that's a wrong choice?

                        – Giovani
                        Mar 9 '17 at 16:28







                        Why do you guys do not propose an acceptable answer instead say that's a wrong choice?

                        – Giovani
                        Mar 9 '17 at 16:28






                        2




                        2





                        Because even though there are acceptable answers on the page, this unacceptable answer is still here.

                        – Teh JoE
                        Aug 24 '17 at 16:00





                        Because even though there are acceptable answers on the page, this unacceptable answer is still here.

                        – Teh JoE
                        Aug 24 '17 at 16:00













                        sudo chmod -R 777 .git/objects

                        – Nabeel Ahmed
                        Apr 9 '18 at 9:31





                        sudo chmod -R 777 .git/objects

                        – Nabeel Ahmed
                        Apr 9 '18 at 9:31











                        9














                        This can easily happen if you ran git init with a different user from the one you are planning to use when pushing changes.



                        If you blindly follow the instructions on [1] this will happen as you probably created the git-user as root and then immediately moved on to git init without changing user in between.



                        [1] http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server






                        share|improve this answer




























                          9














                          This can easily happen if you ran git init with a different user from the one you are planning to use when pushing changes.



                          If you blindly follow the instructions on [1] this will happen as you probably created the git-user as root and then immediately moved on to git init without changing user in between.



                          [1] http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server






                          share|improve this answer


























                            9












                            9








                            9







                            This can easily happen if you ran git init with a different user from the one you are planning to use when pushing changes.



                            If you blindly follow the instructions on [1] this will happen as you probably created the git-user as root and then immediately moved on to git init without changing user in between.



                            [1] http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server






                            share|improve this answer













                            This can easily happen if you ran git init with a different user from the one you are planning to use when pushing changes.



                            If you blindly follow the instructions on [1] this will happen as you probably created the git-user as root and then immediately moved on to git init without changing user in between.



                            [1] http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Sep 5 '14 at 12:12









                            gitzorgitzor

                            9111




                            9111























                                5














                                After you add some stuff... commit them and after all finished push it! BANG!! Start all problems... As you should notice there are some differences in the way both new and existent projects were defined. If some other person tries to add/commit/push same files, or content (git keep both as same objects), we will face the following error:



                                $ git push
                                Counting objects: 31, done.
                                Delta compression using up to 2 threads.
                                Compressing objects: 100% (17/17), done.
                                Writing objects: 100% (21/21), 2.07 KiB | 0 bytes/s, done.
                                Total 21 (delta 12), reused 0 (delta 0)
                                remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object


                                To solve this problem you have to have something in mind operational system's permissions system as you are restricted by it in this case. Tu understand better the problem, go ahead and check your git object's folder (.git/objects). You will probably see something like that:



                                <your user_name>@<the machine name> objects]$ ls -la
                                total 200
                                drwxr-xr-x 25 <your user_name> <group_name> 2048 Feb 10 09:28 .
                                drwxr-xr-x 3 <his user_name> <group_name> 1024 Feb 3 15:06 ..
                                drwxr-xr-x 2 <his user_name> <group_name> 1024 Jan 31 13:39 02
                                drwxr-xr-x 2 <his user_name> <group_name> 1024 Feb 3 13:24 08


                                *Note that those file's permissions were granted only for your users, no one will never can changed it... *



                                Level       u   g   o
                                Permission rwx r-x ---
                                Binary 111 101 000
                                Octal 7 5 0


                                SOLVING THE PROBLEM



                                If you have super user permission, you can go forward and change all permissions by yourself using the step two, in any-other case you will need to ask all users with objects created with their users, use the following command to know who they are:



                                $ ls -la | awk '{print $3}' | sort -u 
                                <your user_name>
                                <his user_name>


                                Now you and all file's owner users will have to change those files permission, doing:



                                $ chmod -R 774 .


                                After that you will need to add a new property that is equivalent to --shared=group done for the new repository, according to the documentation, this make the repository group-writable, do it executing:



                                $ git config core.sharedRepository group


                                https://coderwall.com/p/8b3ksg






                                share|improve this answer
























                                • I had all the same username:groupname for mine, but when I tried chmod -R 774 ., I could then run git add --all successfully.

                                  – John Skilbeck
                                  Jul 15 '15 at 20:32
















                                5














                                After you add some stuff... commit them and after all finished push it! BANG!! Start all problems... As you should notice there are some differences in the way both new and existent projects were defined. If some other person tries to add/commit/push same files, or content (git keep both as same objects), we will face the following error:



                                $ git push
                                Counting objects: 31, done.
                                Delta compression using up to 2 threads.
                                Compressing objects: 100% (17/17), done.
                                Writing objects: 100% (21/21), 2.07 KiB | 0 bytes/s, done.
                                Total 21 (delta 12), reused 0 (delta 0)
                                remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object


                                To solve this problem you have to have something in mind operational system's permissions system as you are restricted by it in this case. Tu understand better the problem, go ahead and check your git object's folder (.git/objects). You will probably see something like that:



                                <your user_name>@<the machine name> objects]$ ls -la
                                total 200
                                drwxr-xr-x 25 <your user_name> <group_name> 2048 Feb 10 09:28 .
                                drwxr-xr-x 3 <his user_name> <group_name> 1024 Feb 3 15:06 ..
                                drwxr-xr-x 2 <his user_name> <group_name> 1024 Jan 31 13:39 02
                                drwxr-xr-x 2 <his user_name> <group_name> 1024 Feb 3 13:24 08


                                *Note that those file's permissions were granted only for your users, no one will never can changed it... *



                                Level       u   g   o
                                Permission rwx r-x ---
                                Binary 111 101 000
                                Octal 7 5 0


                                SOLVING THE PROBLEM



                                If you have super user permission, you can go forward and change all permissions by yourself using the step two, in any-other case you will need to ask all users with objects created with their users, use the following command to know who they are:



                                $ ls -la | awk '{print $3}' | sort -u 
                                <your user_name>
                                <his user_name>


                                Now you and all file's owner users will have to change those files permission, doing:



                                $ chmod -R 774 .


                                After that you will need to add a new property that is equivalent to --shared=group done for the new repository, according to the documentation, this make the repository group-writable, do it executing:



                                $ git config core.sharedRepository group


                                https://coderwall.com/p/8b3ksg






                                share|improve this answer
























                                • I had all the same username:groupname for mine, but when I tried chmod -R 774 ., I could then run git add --all successfully.

                                  – John Skilbeck
                                  Jul 15 '15 at 20:32














                                5












                                5








                                5







                                After you add some stuff... commit them and after all finished push it! BANG!! Start all problems... As you should notice there are some differences in the way both new and existent projects were defined. If some other person tries to add/commit/push same files, or content (git keep both as same objects), we will face the following error:



                                $ git push
                                Counting objects: 31, done.
                                Delta compression using up to 2 threads.
                                Compressing objects: 100% (17/17), done.
                                Writing objects: 100% (21/21), 2.07 KiB | 0 bytes/s, done.
                                Total 21 (delta 12), reused 0 (delta 0)
                                remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object


                                To solve this problem you have to have something in mind operational system's permissions system as you are restricted by it in this case. Tu understand better the problem, go ahead and check your git object's folder (.git/objects). You will probably see something like that:



                                <your user_name>@<the machine name> objects]$ ls -la
                                total 200
                                drwxr-xr-x 25 <your user_name> <group_name> 2048 Feb 10 09:28 .
                                drwxr-xr-x 3 <his user_name> <group_name> 1024 Feb 3 15:06 ..
                                drwxr-xr-x 2 <his user_name> <group_name> 1024 Jan 31 13:39 02
                                drwxr-xr-x 2 <his user_name> <group_name> 1024 Feb 3 13:24 08


                                *Note that those file's permissions were granted only for your users, no one will never can changed it... *



                                Level       u   g   o
                                Permission rwx r-x ---
                                Binary 111 101 000
                                Octal 7 5 0


                                SOLVING THE PROBLEM



                                If you have super user permission, you can go forward and change all permissions by yourself using the step two, in any-other case you will need to ask all users with objects created with their users, use the following command to know who they are:



                                $ ls -la | awk '{print $3}' | sort -u 
                                <your user_name>
                                <his user_name>


                                Now you and all file's owner users will have to change those files permission, doing:



                                $ chmod -R 774 .


                                After that you will need to add a new property that is equivalent to --shared=group done for the new repository, according to the documentation, this make the repository group-writable, do it executing:



                                $ git config core.sharedRepository group


                                https://coderwall.com/p/8b3ksg






                                share|improve this answer













                                After you add some stuff... commit them and after all finished push it! BANG!! Start all problems... As you should notice there are some differences in the way both new and existent projects were defined. If some other person tries to add/commit/push same files, or content (git keep both as same objects), we will face the following error:



                                $ git push
                                Counting objects: 31, done.
                                Delta compression using up to 2 threads.
                                Compressing objects: 100% (17/17), done.
                                Writing objects: 100% (21/21), 2.07 KiB | 0 bytes/s, done.
                                Total 21 (delta 12), reused 0 (delta 0)
                                remote: error: insufficient permission for adding an object to repository database ./objects remote: fatal: failed to write object


                                To solve this problem you have to have something in mind operational system's permissions system as you are restricted by it in this case. Tu understand better the problem, go ahead and check your git object's folder (.git/objects). You will probably see something like that:



                                <your user_name>@<the machine name> objects]$ ls -la
                                total 200
                                drwxr-xr-x 25 <your user_name> <group_name> 2048 Feb 10 09:28 .
                                drwxr-xr-x 3 <his user_name> <group_name> 1024 Feb 3 15:06 ..
                                drwxr-xr-x 2 <his user_name> <group_name> 1024 Jan 31 13:39 02
                                drwxr-xr-x 2 <his user_name> <group_name> 1024 Feb 3 13:24 08


                                *Note that those file's permissions were granted only for your users, no one will never can changed it... *



                                Level       u   g   o
                                Permission rwx r-x ---
                                Binary 111 101 000
                                Octal 7 5 0


                                SOLVING THE PROBLEM



                                If you have super user permission, you can go forward and change all permissions by yourself using the step two, in any-other case you will need to ask all users with objects created with their users, use the following command to know who they are:



                                $ ls -la | awk '{print $3}' | sort -u 
                                <your user_name>
                                <his user_name>


                                Now you and all file's owner users will have to change those files permission, doing:



                                $ chmod -R 774 .


                                After that you will need to add a new property that is equivalent to --shared=group done for the new repository, according to the documentation, this make the repository group-writable, do it executing:



                                $ git config core.sharedRepository group


                                https://coderwall.com/p/8b3ksg







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Feb 14 '14 at 0:04









                                helmedeiroshelmedeiros

                                35943




                                35943













                                • I had all the same username:groupname for mine, but when I tried chmod -R 774 ., I could then run git add --all successfully.

                                  – John Skilbeck
                                  Jul 15 '15 at 20:32



















                                • I had all the same username:groupname for mine, but when I tried chmod -R 774 ., I could then run git add --all successfully.

                                  – John Skilbeck
                                  Jul 15 '15 at 20:32

















                                I had all the same username:groupname for mine, but when I tried chmod -R 774 ., I could then run git add --all successfully.

                                – John Skilbeck
                                Jul 15 '15 at 20:32





                                I had all the same username:groupname for mine, but when I tried chmod -R 774 ., I could then run git add --all successfully.

                                – John Skilbeck
                                Jul 15 '15 at 20:32











                                4














                                Linux, macOS:



                                cd .git/
                                sudo chown -R name:group *


                                where name is your username and group is the group that your username belongs to.






                                share|improve this answer




























                                  4














                                  Linux, macOS:



                                  cd .git/
                                  sudo chown -R name:group *


                                  where name is your username and group is the group that your username belongs to.






                                  share|improve this answer


























                                    4












                                    4








                                    4







                                    Linux, macOS:



                                    cd .git/
                                    sudo chown -R name:group *


                                    where name is your username and group is the group that your username belongs to.






                                    share|improve this answer













                                    Linux, macOS:



                                    cd .git/
                                    sudo chown -R name:group *


                                    where name is your username and group is the group that your username belongs to.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Dec 2 '16 at 15:26









                                    Afshin MehrabaniAfshin Mehrabani

                                    13.8k2199160




                                    13.8k2199160























                                        3














                                        For my case none of the suggestions worked. I'm on Windows and this worked for me:




                                        • Copy the remote repo into another folder

                                        • Share the folder and give appropriate permissions.

                                        • Make sure you can access the folder from your local machine.

                                        • Add this repo as another remote repo in your local repo. (git remote add foo //SERVERNAME/path/to/copied/git)

                                        • Push to foo. git push foo master. Did it worked? Great! Now delete not-working repo and rename this into whatever it was before. Make sure permissions and share property remains the same.






                                        share|improve this answer



















                                        • 1





                                          In my case, simply copying the local folder to a new folder, deleting the old one, and renaming the new one to the old name fixed the permissions issues.

                                          – mgiuffrida
                                          Jan 30 '17 at 21:33
















                                        3














                                        For my case none of the suggestions worked. I'm on Windows and this worked for me:




                                        • Copy the remote repo into another folder

                                        • Share the folder and give appropriate permissions.

                                        • Make sure you can access the folder from your local machine.

                                        • Add this repo as another remote repo in your local repo. (git remote add foo //SERVERNAME/path/to/copied/git)

                                        • Push to foo. git push foo master. Did it worked? Great! Now delete not-working repo and rename this into whatever it was before. Make sure permissions and share property remains the same.






                                        share|improve this answer



















                                        • 1





                                          In my case, simply copying the local folder to a new folder, deleting the old one, and renaming the new one to the old name fixed the permissions issues.

                                          – mgiuffrida
                                          Jan 30 '17 at 21:33














                                        3












                                        3








                                        3







                                        For my case none of the suggestions worked. I'm on Windows and this worked for me:




                                        • Copy the remote repo into another folder

                                        • Share the folder and give appropriate permissions.

                                        • Make sure you can access the folder from your local machine.

                                        • Add this repo as another remote repo in your local repo. (git remote add foo //SERVERNAME/path/to/copied/git)

                                        • Push to foo. git push foo master. Did it worked? Great! Now delete not-working repo and rename this into whatever it was before. Make sure permissions and share property remains the same.






                                        share|improve this answer













                                        For my case none of the suggestions worked. I'm on Windows and this worked for me:




                                        • Copy the remote repo into another folder

                                        • Share the folder and give appropriate permissions.

                                        • Make sure you can access the folder from your local machine.

                                        • Add this repo as another remote repo in your local repo. (git remote add foo //SERVERNAME/path/to/copied/git)

                                        • Push to foo. git push foo master. Did it worked? Great! Now delete not-working repo and rename this into whatever it was before. Make sure permissions and share property remains the same.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Feb 20 '15 at 15:20









                                        Halil KaskavalciHalil Kaskavalci

                                        7461025




                                        7461025








                                        • 1





                                          In my case, simply copying the local folder to a new folder, deleting the old one, and renaming the new one to the old name fixed the permissions issues.

                                          – mgiuffrida
                                          Jan 30 '17 at 21:33














                                        • 1





                                          In my case, simply copying the local folder to a new folder, deleting the old one, and renaming the new one to the old name fixed the permissions issues.

                                          – mgiuffrida
                                          Jan 30 '17 at 21:33








                                        1




                                        1





                                        In my case, simply copying the local folder to a new folder, deleting the old one, and renaming the new one to the old name fixed the permissions issues.

                                        – mgiuffrida
                                        Jan 30 '17 at 21:33





                                        In my case, simply copying the local folder to a new folder, deleting the old one, and renaming the new one to the old name fixed the permissions issues.

                                        – mgiuffrida
                                        Jan 30 '17 at 21:33











                                        2














                                        I hit this same issue. Reading around here I realised it was file permissions the message was referring to. The fix , for me, was in:



                                        /etc/inetd.d/git-gpv



                                        It was starting git-daemon as user 'nobody' so lacked the write permission.



                                        # Who   When    What
                                        # GPV 20Nov13 Created this by hand while reading: http://linuxclues.blogspot.co.uk/2013/06>/git-daemon-ssh-create-repository-debian.html
                                        # GPV 20Nov13 Changed owner (to user_git) otherise nobody lack permission to update the repository
                                        #git stream tcp nowait nobody /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo
                                        git stream tcp nowait user_git /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo


                                        (I doubt other call their inetd conf file git-gpv . Commonly it would be directly in /etc/inetd.conf)






                                        share|improve this answer




























                                          2














                                          I hit this same issue. Reading around here I realised it was file permissions the message was referring to. The fix , for me, was in:



                                          /etc/inetd.d/git-gpv



                                          It was starting git-daemon as user 'nobody' so lacked the write permission.



                                          # Who   When    What
                                          # GPV 20Nov13 Created this by hand while reading: http://linuxclues.blogspot.co.uk/2013/06>/git-daemon-ssh-create-repository-debian.html
                                          # GPV 20Nov13 Changed owner (to user_git) otherise nobody lack permission to update the repository
                                          #git stream tcp nowait nobody /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo
                                          git stream tcp nowait user_git /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo


                                          (I doubt other call their inetd conf file git-gpv . Commonly it would be directly in /etc/inetd.conf)






                                          share|improve this answer


























                                            2












                                            2








                                            2







                                            I hit this same issue. Reading around here I realised it was file permissions the message was referring to. The fix , for me, was in:



                                            /etc/inetd.d/git-gpv



                                            It was starting git-daemon as user 'nobody' so lacked the write permission.



                                            # Who   When    What
                                            # GPV 20Nov13 Created this by hand while reading: http://linuxclues.blogspot.co.uk/2013/06>/git-daemon-ssh-create-repository-debian.html
                                            # GPV 20Nov13 Changed owner (to user_git) otherise nobody lack permission to update the repository
                                            #git stream tcp nowait nobody /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo
                                            git stream tcp nowait user_git /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo


                                            (I doubt other call their inetd conf file git-gpv . Commonly it would be directly in /etc/inetd.conf)






                                            share|improve this answer













                                            I hit this same issue. Reading around here I realised it was file permissions the message was referring to. The fix , for me, was in:



                                            /etc/inetd.d/git-gpv



                                            It was starting git-daemon as user 'nobody' so lacked the write permission.



                                            # Who   When    What
                                            # GPV 20Nov13 Created this by hand while reading: http://linuxclues.blogspot.co.uk/2013/06>/git-daemon-ssh-create-repository-debian.html
                                            # GPV 20Nov13 Changed owner (to user_git) otherise nobody lack permission to update the repository
                                            #git stream tcp nowait nobody /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo
                                            git stream tcp nowait user_git /usr/bin/git git daemon --inetd --verbose --enable=receive-pack --export-all /gitrepo


                                            (I doubt other call their inetd conf file git-gpv . Commonly it would be directly in /etc/inetd.conf)







                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Nov 20 '13 at 17:06









                                            GraemeVGraemeV

                                            211




                                            211























                                                1














                                                You need the sufficient write permissions on the directory that you are pushing to.



                                                In my case: Windows 2008 server



                                                right click on git repo directory or parent directory.



                                                Properties > Sharing tab > Advanced Sharing > Permissions > make sure the user has appropriate access rights.






                                                share|improve this answer




























                                                  1














                                                  You need the sufficient write permissions on the directory that you are pushing to.



                                                  In my case: Windows 2008 server



                                                  right click on git repo directory or parent directory.



                                                  Properties > Sharing tab > Advanced Sharing > Permissions > make sure the user has appropriate access rights.






                                                  share|improve this answer


























                                                    1












                                                    1








                                                    1







                                                    You need the sufficient write permissions on the directory that you are pushing to.



                                                    In my case: Windows 2008 server



                                                    right click on git repo directory or parent directory.



                                                    Properties > Sharing tab > Advanced Sharing > Permissions > make sure the user has appropriate access rights.






                                                    share|improve this answer













                                                    You need the sufficient write permissions on the directory that you are pushing to.



                                                    In my case: Windows 2008 server



                                                    right click on git repo directory or parent directory.



                                                    Properties > Sharing tab > Advanced Sharing > Permissions > make sure the user has appropriate access rights.







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Dec 4 '14 at 19:06









                                                    Fuyu PersimmonFuyu Persimmon

                                                    356512




                                                    356512























                                                        1














                                                        You may have accidentally nested git repositories






                                                        share|improve this answer






























                                                          1














                                                          You may have accidentally nested git repositories






                                                          share|improve this answer




























                                                            1












                                                            1








                                                            1







                                                            You may have accidentally nested git repositories






                                                            share|improve this answer















                                                            You may have accidentally nested git repositories







                                                            share|improve this answer














                                                            share|improve this answer



                                                            share|improve this answer








                                                            edited Jul 30 '18 at 21:47

























                                                            answered Sep 22 '15 at 23:43









                                                            IliasTIliasT

                                                            1,3891215




                                                            1,3891215























                                                                1














                                                                There is a possibility also that you added another local repository with the same alias. As an example, you now have 2 local folders referred to as origin so when you try to push, the remote repository will not accept you credentials.



                                                                Rename the local repository aliases, you can follow this link https://stackoverflow.com/a/26651835/2270348



                                                                Maybe you can leave 1 local repository of your liking as origin and the others rename them for example from origin to anotherorigin. Remember these are just aliases and all you need to do is remember the new aliases and their respective remote branches.






                                                                share|improve this answer




























                                                                  1














                                                                  There is a possibility also that you added another local repository with the same alias. As an example, you now have 2 local folders referred to as origin so when you try to push, the remote repository will not accept you credentials.



                                                                  Rename the local repository aliases, you can follow this link https://stackoverflow.com/a/26651835/2270348



                                                                  Maybe you can leave 1 local repository of your liking as origin and the others rename them for example from origin to anotherorigin. Remember these are just aliases and all you need to do is remember the new aliases and their respective remote branches.






                                                                  share|improve this answer


























                                                                    1












                                                                    1








                                                                    1







                                                                    There is a possibility also that you added another local repository with the same alias. As an example, you now have 2 local folders referred to as origin so when you try to push, the remote repository will not accept you credentials.



                                                                    Rename the local repository aliases, you can follow this link https://stackoverflow.com/a/26651835/2270348



                                                                    Maybe you can leave 1 local repository of your liking as origin and the others rename them for example from origin to anotherorigin. Remember these are just aliases and all you need to do is remember the new aliases and their respective remote branches.






                                                                    share|improve this answer













                                                                    There is a possibility also that you added another local repository with the same alias. As an example, you now have 2 local folders referred to as origin so when you try to push, the remote repository will not accept you credentials.



                                                                    Rename the local repository aliases, you can follow this link https://stackoverflow.com/a/26651835/2270348



                                                                    Maybe you can leave 1 local repository of your liking as origin and the others rename them for example from origin to anotherorigin. Remember these are just aliases and all you need to do is remember the new aliases and their respective remote branches.







                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered Nov 19 '18 at 8:00









                                                                    Huey MataruseHuey Mataruse

                                                                    12113




                                                                    12113

















                                                                        protected by zero323 Dec 23 '15 at 6:58



                                                                        Thank you for your interest in this question.
                                                                        Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                                        Would you like to answer one of these unanswered questions instead?



                                                                        Popular posts from this blog

                                                                        How to change which sound is reproduced for terminal bell?

                                                                        Can I use Tabulator js library in my java Spring + Thymeleaf project?

                                                                        Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents