Visitar URL original
Unable to remove directory when head is used · Issue #2101 · gitpython-developers/GitPython · GitHub
Skip to content

Unable to remove directory when head is used #2101

Description

@cbfbl

GitPython version - 3.1.46
Python version - 3.13.9

Basically the following fails

import shutil
from git import repo

repo = Repo("some_url", "some_directory")
print(repo.head.commit.hexsha)
shutil.rmtree("some_directory")

Getting an error shutils rmtree failed and was not able to the delete the .git inside "some_directory"

Activity

  1. Byron commented on Feb 19, 2026

    @Byron
    Member

    Which platform is this on? I must presume Windows, and if so, that's a known issue with no solution.

  2. added theissue type on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions