Trying to remove git repo on ubuntu guest

前端 未结 4 782
清酒与你
清酒与你 2021-02-08 02:53

I am trying to remove whole git repository from my local machine, but git prohibits to delete several files.

I\'ve tried:

  1. rm -r folder
相关标签:
4条回答
  • 2021-02-08 03:20
    1. Close any git clients that might be running.

    2. Set the permissions to delete first:

      chmod -R 777 folder
      
    3. Try to force the deletion:

      rm -rf folder
      
    0 讨论(0)
  • 2021-02-08 03:40

    The following command may help:

    chmod -R u+w folder/
    

    Also make sure you own all the files which you're trying to remove:

    chown -R $USER folder/
    

    On Linux it may be also a file attribute (check by lsattr):

    chattr -R -AacdDijsStu folder/
    
    0 讨论(0)
  • 2021-02-08 03:42

    So I figured it out. The problem was that on my host machine (windows 7 x64) this folder was allowed to read only. I disabled it, and removed it from the host machine. Sorry for not saying that it was mounted, and thanks for all replies : )

    0 讨论(0)
  • 2021-02-08 03:43

    In my case, for some reason the user immutable flag (uchg) was switched on for everything in the .git folder. This fixed it:

    chflags -R nouchg folder/
    

    I could then delete with rm -rf folder/.

    0 讨论(0)
提交回复
热议问题