windows - 删除 git 目录时出现 "permission denied"

标签 windows git git-bash

我正在尝试在使用 win7 和 git-bash 时删除 .git 目录。这是我的尝试:

$ 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

我做错了什么?

最佳答案

Windows 7 - Git-bash

$ sudo
sh.exe": sudo: command not found

Windows 中的 git-bash 没有 sudo 命令。

很可能,您在命令 shell 中以提升的权限使用了一些 git 命令。在 Windows 7 中,您的普通用户和具有提升权限的用户具有不同的权力。尝试执行以下操作之一

  1. 尝试在 Windows 资源管理器中删除该目录
  2. 以管理员身份启动 git bash 并运行 rm 命令。
  3. 尝试更改其权限,以便您的普通用户可以完全控制该目录。

关于windows - 删除 git 目录时出现 "permission denied",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27590276/

相关文章:

c++ - 检查一个文件是否包含另一个文件

c# - 如何在 Win10 的新 Outlook 应用程序中实现滑动手势?

git - 为什么 git fetch via hudson 失败,而 git fetch 通过命令行工作?

linux - Jenkins 无法通过 SSH 进入 github

git - Jenkins - 管道访问git分支名称

windows - Git 克隆在 Windows 10 中显示错误并将文件标记为已删除

git - 如何创建自定义 git/bash 脚本?

windows - "tls: oversized record received with length 20527"仅尝试从 Win10 WSL Bash 到 "docker run"

c# - 重命名正在运行的应用程序 - 危险吗?

Git Bash 在网上邻居中创建存储库?