简体   繁体   English

如何使用 gitpython 克隆 git 存储库而不与 git 关联?

[英]How to clone a git repository without association with git using gitpython?

When I clone the repository using the following code the repository gets cloned into local but it is also associated with GIT.当我使用以下代码克隆存储库时,存储库被克隆到本地,但它也与 GIT 相关联。

from git import Repo
Repo.clone_from(url, path)

And If I want to remove the directory using the following如果我想使用以下内容删除目录

shutil.rmtree(path)

I get the permission error.我得到权限错误。 I'm looking for either a way to remove the directory even if it is associated with git or clone it into local without being associated with git in the first place.我正在寻找一种方法来删除目录,即使它与 git 相关联或将其克隆到本地而不首先与 git 相关联。 Later one is a preferred approach if possible.如果可能,后一种方法是首选方法。

Windows will not allow you to delete a file or directory if something has it open. Windows 不允许您删除已打开的文件或目录。 You mentioned " A green tick mark appears on the cloned repository "; 您提到克隆的存储库上出现绿色刻度线”; I expect you have an application which is holding the.git directory open.我希望您有一个应用程序,它打开了 .git 目录。 Close that application, then I expect it will work.关闭该应用程序,然后我希望它会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM