In my project I have used the python-git module to clone the repo.
but for the cleanup I have to remove the directory as well.I am using the following method for cleanup but it did not work.
def clone(self): if os.path.isdir(self.clone_dir): print("clone directory already exist.") print(f"Removing ... {self.clone_dir}") os.remove(self.clone_dir) try: Repo.clone_from(self.github_url, self.clone_dir) except Exception: raise Exception(f"Cant able to clone the repo {self.github_url}")
but this gives the error of - self.clone_dir is a directory
os.remove(self.clone_dir)IsADirectoryError: \[Errno 21\] Is a directory: '/tmp/git/2bbf1c95-b981-4d7e-a000-9c25b8d84ffc'
Any Efficient way to remove the git directory and well the UUID
tried -list all the files then loop every file and then remove it.