I'm trying to remove a .git directory while using win7 and git-bash. here's my attempt:
$ rm -rf .git
rm: cannot remove directory `.git/objects/5e': Permission denied
rm: cannot remove directory `.git/objects': Directory not empty
rm: cannot remove directory `.git': Directory not empty
$ rmdir .git
rmdir: `.git': Directory not empty
What am I doing wrong?
Just run the rm command with the -f and -r switch to recursively remove the . git folder and all of the files and folders it contains. This Git repo remove command also allows you to delete the Git repo while allowing all of the other files and folder to remain untouched.
Open the Terminal on Linux and execute sudo su to access Root, then type your root password and press Enter. On Linux, you can use the ls command to display the directory in your current location. To delete the undeleted folder, execute rm -rf vmware-tools-distrib.
If you get the error "Permission denied", it is also possible that git doesn't have permission to create the project folder locally. Check permissions for the directory where you're attempting to check out the project, and make sure you have write access.
To remove world read permission from a file you would type chmod o-r [filename]. To remove group read and execute permission while adding the same permission to world you would type chmod g-rx,o+rx [filename]. To remove all permissions for group and world you would type chmod go= [filename].
I faced with similar problem. It turns out that git makes certain files (objects) read only. So you need to remove read-only flag recursively and then remove folder:
chmod -R a+w .git
rm -rf .git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With