WSL Ubuntu Distro | How to solve `Operation not permitted` on cloning repository












0















I am running Ubuntu 18.04, as a Subsystem for Windows. I have done this in mutliple PCs and never had this problem. I try to to git clone <repo>, and I get this:



Cloning into '<repo>'...
error: chmod on /mnt/c/Users/Efsta/Code/<repo>/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'


I tried the following:




  1. ❯ git config core.fileMode false, with this result
    fatal: not in a git directory


  2. ❯ git config --global core.filemode false


  3. ❯ git config --add --global core.filemode false



Nothing seems to work. I already tried a couple of answers here, but WSL seems a little bit more tricky. Anyone have any idea about how to solve this?



I have also tried everything in this question : https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes, nothing seems to work.










share|improve this question





























    0















    I am running Ubuntu 18.04, as a Subsystem for Windows. I have done this in mutliple PCs and never had this problem. I try to to git clone <repo>, and I get this:



    Cloning into '<repo>'...
    error: chmod on /mnt/c/Users/Efsta/Code/<repo>/.git/config.lock failed: Operation not permitted
    fatal: could not set 'core.filemode' to 'false'


    I tried the following:




    1. ❯ git config core.fileMode false, with this result
      fatal: not in a git directory


    2. ❯ git config --global core.filemode false


    3. ❯ git config --add --global core.filemode false



    Nothing seems to work. I already tried a couple of answers here, but WSL seems a little bit more tricky. Anyone have any idea about how to solve this?



    I have also tried everything in this question : https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes, nothing seems to work.










    share|improve this question



























      0












      0








      0








      I am running Ubuntu 18.04, as a Subsystem for Windows. I have done this in mutliple PCs and never had this problem. I try to to git clone <repo>, and I get this:



      Cloning into '<repo>'...
      error: chmod on /mnt/c/Users/Efsta/Code/<repo>/.git/config.lock failed: Operation not permitted
      fatal: could not set 'core.filemode' to 'false'


      I tried the following:




      1. ❯ git config core.fileMode false, with this result
        fatal: not in a git directory


      2. ❯ git config --global core.filemode false


      3. ❯ git config --add --global core.filemode false



      Nothing seems to work. I already tried a couple of answers here, but WSL seems a little bit more tricky. Anyone have any idea about how to solve this?



      I have also tried everything in this question : https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes, nothing seems to work.










      share|improve this question
















      I am running Ubuntu 18.04, as a Subsystem for Windows. I have done this in mutliple PCs and never had this problem. I try to to git clone <repo>, and I get this:



      Cloning into '<repo>'...
      error: chmod on /mnt/c/Users/Efsta/Code/<repo>/.git/config.lock failed: Operation not permitted
      fatal: could not set 'core.filemode' to 'false'


      I tried the following:




      1. ❯ git config core.fileMode false, with this result
        fatal: not in a git directory


      2. ❯ git config --global core.filemode false


      3. ❯ git config --add --global core.filemode false



      Nothing seems to work. I already tried a couple of answers here, but WSL seems a little bit more tricky. Anyone have any idea about how to solve this?



      I have also tried everything in this question : https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes, nothing seems to work.







      git chmod windows-subsystem-for-linux clone






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 4 at 16:31







      Dimitris Efst

















      asked Feb 4 at 16:18









      Dimitris EfstDimitris Efst

      13




      13






















          2 Answers
          2






          active

          oldest

          votes


















          0














          /mt/c/Users/... is on the Windows NTFS partition itself, and not within the WSL's ext4 formatted system. Therefore you have to treat it as you would an NTFS partition on a USB stick on an actual Ubuntu installation, and accept the limitations of NTFS.



          NTFS partitions do not support chmod or similar Linux permissions commands, and unlike in actual Ubuntu instalations which don't error but don't make any permissions changes, WSL doesn't relay this information back to you, it simply errors out as you see here.



          You cannot do a git clone sanely into the /mnt/c/... space within WSL because of the Linux permission schemas and chmod not working right. This is a limitation of WSL in its current form.






          share|improve this answer
























          • Ok let me confirm some things. Microsoft says, that I should develop in WSL within Windows, so I can modify them on both the WSL and Windows sides. So, in every other installation I had until now, I did the same. And if we assume that what youa re saying is correct, what would you recommend as a soution to my problem?

            – Dimitris Efst
            Feb 4 at 16:45













          • And to add to my above question. What do I do about ssh? Can I resuse the same key on both. There are situations like gcloud where I want to use my windows deve enviroment instead...

            – Dimitris Efst
            Feb 4 at 16:47











          • Also, previously I was using WLinux, which was slow, but witht the same underlying theory used the Windows filesystem, and I could do it as well. So, not an Ubuntu specific thing.Sorry for spamming you

            – Dimitris Efst
            Feb 4 at 16:50



















          0














          I had the same issue. Try this:



          sudo umount /mnt/C
          sudo mount -t drvfs C: /mnt/C -o metadata


          Change the drive letter to whatever one you're having the issue with.






          share|improve this answer























            Your Answer








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

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

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1115564%2fwsl-ubuntu-distro-how-to-solve-operation-not-permitted-on-cloning-repository%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            /mt/c/Users/... is on the Windows NTFS partition itself, and not within the WSL's ext4 formatted system. Therefore you have to treat it as you would an NTFS partition on a USB stick on an actual Ubuntu installation, and accept the limitations of NTFS.



            NTFS partitions do not support chmod or similar Linux permissions commands, and unlike in actual Ubuntu instalations which don't error but don't make any permissions changes, WSL doesn't relay this information back to you, it simply errors out as you see here.



            You cannot do a git clone sanely into the /mnt/c/... space within WSL because of the Linux permission schemas and chmod not working right. This is a limitation of WSL in its current form.






            share|improve this answer
























            • Ok let me confirm some things. Microsoft says, that I should develop in WSL within Windows, so I can modify them on both the WSL and Windows sides. So, in every other installation I had until now, I did the same. And if we assume that what youa re saying is correct, what would you recommend as a soution to my problem?

              – Dimitris Efst
              Feb 4 at 16:45













            • And to add to my above question. What do I do about ssh? Can I resuse the same key on both. There are situations like gcloud where I want to use my windows deve enviroment instead...

              – Dimitris Efst
              Feb 4 at 16:47











            • Also, previously I was using WLinux, which was slow, but witht the same underlying theory used the Windows filesystem, and I could do it as well. So, not an Ubuntu specific thing.Sorry for spamming you

              – Dimitris Efst
              Feb 4 at 16:50
















            0














            /mt/c/Users/... is on the Windows NTFS partition itself, and not within the WSL's ext4 formatted system. Therefore you have to treat it as you would an NTFS partition on a USB stick on an actual Ubuntu installation, and accept the limitations of NTFS.



            NTFS partitions do not support chmod or similar Linux permissions commands, and unlike in actual Ubuntu instalations which don't error but don't make any permissions changes, WSL doesn't relay this information back to you, it simply errors out as you see here.



            You cannot do a git clone sanely into the /mnt/c/... space within WSL because of the Linux permission schemas and chmod not working right. This is a limitation of WSL in its current form.






            share|improve this answer
























            • Ok let me confirm some things. Microsoft says, that I should develop in WSL within Windows, so I can modify them on both the WSL and Windows sides. So, in every other installation I had until now, I did the same. And if we assume that what youa re saying is correct, what would you recommend as a soution to my problem?

              – Dimitris Efst
              Feb 4 at 16:45













            • And to add to my above question. What do I do about ssh? Can I resuse the same key on both. There are situations like gcloud where I want to use my windows deve enviroment instead...

              – Dimitris Efst
              Feb 4 at 16:47











            • Also, previously I was using WLinux, which was slow, but witht the same underlying theory used the Windows filesystem, and I could do it as well. So, not an Ubuntu specific thing.Sorry for spamming you

              – Dimitris Efst
              Feb 4 at 16:50














            0












            0








            0







            /mt/c/Users/... is on the Windows NTFS partition itself, and not within the WSL's ext4 formatted system. Therefore you have to treat it as you would an NTFS partition on a USB stick on an actual Ubuntu installation, and accept the limitations of NTFS.



            NTFS partitions do not support chmod or similar Linux permissions commands, and unlike in actual Ubuntu instalations which don't error but don't make any permissions changes, WSL doesn't relay this information back to you, it simply errors out as you see here.



            You cannot do a git clone sanely into the /mnt/c/... space within WSL because of the Linux permission schemas and chmod not working right. This is a limitation of WSL in its current form.






            share|improve this answer













            /mt/c/Users/... is on the Windows NTFS partition itself, and not within the WSL's ext4 formatted system. Therefore you have to treat it as you would an NTFS partition on a USB stick on an actual Ubuntu installation, and accept the limitations of NTFS.



            NTFS partitions do not support chmod or similar Linux permissions commands, and unlike in actual Ubuntu instalations which don't error but don't make any permissions changes, WSL doesn't relay this information back to you, it simply errors out as you see here.



            You cannot do a git clone sanely into the /mnt/c/... space within WSL because of the Linux permission schemas and chmod not working right. This is a limitation of WSL in its current form.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 4 at 16:39









            Thomas WardThomas Ward

            44.9k23125178




            44.9k23125178













            • Ok let me confirm some things. Microsoft says, that I should develop in WSL within Windows, so I can modify them on both the WSL and Windows sides. So, in every other installation I had until now, I did the same. And if we assume that what youa re saying is correct, what would you recommend as a soution to my problem?

              – Dimitris Efst
              Feb 4 at 16:45













            • And to add to my above question. What do I do about ssh? Can I resuse the same key on both. There are situations like gcloud where I want to use my windows deve enviroment instead...

              – Dimitris Efst
              Feb 4 at 16:47











            • Also, previously I was using WLinux, which was slow, but witht the same underlying theory used the Windows filesystem, and I could do it as well. So, not an Ubuntu specific thing.Sorry for spamming you

              – Dimitris Efst
              Feb 4 at 16:50



















            • Ok let me confirm some things. Microsoft says, that I should develop in WSL within Windows, so I can modify them on both the WSL and Windows sides. So, in every other installation I had until now, I did the same. And if we assume that what youa re saying is correct, what would you recommend as a soution to my problem?

              – Dimitris Efst
              Feb 4 at 16:45













            • And to add to my above question. What do I do about ssh? Can I resuse the same key on both. There are situations like gcloud where I want to use my windows deve enviroment instead...

              – Dimitris Efst
              Feb 4 at 16:47











            • Also, previously I was using WLinux, which was slow, but witht the same underlying theory used the Windows filesystem, and I could do it as well. So, not an Ubuntu specific thing.Sorry for spamming you

              – Dimitris Efst
              Feb 4 at 16:50

















            Ok let me confirm some things. Microsoft says, that I should develop in WSL within Windows, so I can modify them on both the WSL and Windows sides. So, in every other installation I had until now, I did the same. And if we assume that what youa re saying is correct, what would you recommend as a soution to my problem?

            – Dimitris Efst
            Feb 4 at 16:45







            Ok let me confirm some things. Microsoft says, that I should develop in WSL within Windows, so I can modify them on both the WSL and Windows sides. So, in every other installation I had until now, I did the same. And if we assume that what youa re saying is correct, what would you recommend as a soution to my problem?

            – Dimitris Efst
            Feb 4 at 16:45















            And to add to my above question. What do I do about ssh? Can I resuse the same key on both. There are situations like gcloud where I want to use my windows deve enviroment instead...

            – Dimitris Efst
            Feb 4 at 16:47





            And to add to my above question. What do I do about ssh? Can I resuse the same key on both. There are situations like gcloud where I want to use my windows deve enviroment instead...

            – Dimitris Efst
            Feb 4 at 16:47













            Also, previously I was using WLinux, which was slow, but witht the same underlying theory used the Windows filesystem, and I could do it as well. So, not an Ubuntu specific thing.Sorry for spamming you

            – Dimitris Efst
            Feb 4 at 16:50





            Also, previously I was using WLinux, which was slow, but witht the same underlying theory used the Windows filesystem, and I could do it as well. So, not an Ubuntu specific thing.Sorry for spamming you

            – Dimitris Efst
            Feb 4 at 16:50













            0














            I had the same issue. Try this:



            sudo umount /mnt/C
            sudo mount -t drvfs C: /mnt/C -o metadata


            Change the drive letter to whatever one you're having the issue with.






            share|improve this answer




























              0














              I had the same issue. Try this:



              sudo umount /mnt/C
              sudo mount -t drvfs C: /mnt/C -o metadata


              Change the drive letter to whatever one you're having the issue with.






              share|improve this answer


























                0












                0








                0







                I had the same issue. Try this:



                sudo umount /mnt/C
                sudo mount -t drvfs C: /mnt/C -o metadata


                Change the drive letter to whatever one you're having the issue with.






                share|improve this answer













                I had the same issue. Try this:



                sudo umount /mnt/C
                sudo mount -t drvfs C: /mnt/C -o metadata


                Change the drive letter to whatever one you're having the issue with.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 14 at 9:01









                Wojtek GrojecWojtek Grojec

                1




                1






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1115564%2fwsl-ubuntu-distro-how-to-solve-operation-not-permitted-on-cloning-repository%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Questions related to Moebius Transform of Characteristic Function of the Primes

                    Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?