Trying to remove git repo on ubuntu guest

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

I’ve tried:

  • Why does 'git status' ignore the .gitattributes clean filter?
  • the development server returned response error code 500 - react native - ./configs/main
  • Is it possible to get git to automatically update notes on the remote server when I do a git push/git pull
  • How to push to remote repo under another user
  • 502 Bad Gateway from Nginx for large GitLab fork
  • How to embed an updated git-hash into Version.hpp?
    1. rm -r folder
    2. It asked me do I want to delete some write-protected files? I’ve asked y.
    3. Following message appeared:

      rm: cannot remove ‘.git/objects/08/fa4fcd8413b84a1605e1c4866cb2493daf4c4e’: Operation not permitted
      rm: cannot remove ‘.git/objects/96/de4fe9aa42239290cae341427649f2afbdab16’: Operation not permitted
      rm: cannot remove ‘.git/objects/fd/ed37600b5fe66e1a0d0e4355b387e56ca2638e’: Operation not permitted
      rm: cannot remove ‘.git/objects/pack/pack-cb277ab3b4a3510209a9784a76760e6281da5218.idx’: Operation not permitted
      rm: cannot remove ‘.git/objects/pack/pack-cb277ab3b4a3510209a9784a76760e6281da5218.pack’: Operation not permitted
      

    The ls command showed that all local files were deleted. Then I tried sudo rm -r .git from that folder – same result.

    Help me please delete that folder.

  • Setting up Git repo with other Git repo with Submodule? (WordPress development)
  • My git branch is showing 'origin/master' and 'origin/HEAD' in Sourcetree and I don't know how to merge the two
  • Speed up Git Pushing/Pulling
  • How to list what changed during a merge in Git?
  • What is the difference between “py” and “pyc” in .gitignore notation?
  • Webpack and git in multi user mode
  • 3 Solutions collect form web for “Trying to remove git repo on ubuntu guest”

    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
      

    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 : )

    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/
    
    Git Baby is a git and github fan, let's start git clone.