如何删除在桌面上创建的 git 存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17369850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 16:27:16  来源:igfitidea点击:

How to remove git repository created on desktop

gitwindows-7desktop

提问by Aseem Bansal

I accidentally made my Desktop a git repository. How to remove the git-related files from Desktop?

我不小心把我的桌面变成了一个 git 存储库。如何从桌面上删除与 git 相关的文件?

  • I have tried to go to C:/User/my_user/Desktop and un-hide hidden git files but couldn't un-hide them.
  • Then I tried to delete the files using Windows Powershell but it isn't listing these files either.
  • I have also tried finding options in GitExtensions for some option to delete the git files but couldn't find any such option.
  • Couldn't find option in Git GUI
  • 我试图去 C:/User/my_user/Desktop 并取消隐藏隐藏的 git 文件,但无法取消隐藏它们。
  • 然后我尝试使用 Windows Powershell 删除这些文件,但它也没有列出这些文件。
  • 我还尝试在 GitExtensions 中找到一些选项来删除 git 文件,但找不到任何这样的选项。
  • 在 Git GUI 中找不到选项

There is a git repository for sure because I can use GitEx Browseoption in the right click menu.

肯定有一个 git 存储库,因为我可以使用GitEx Browse右键菜单中的选项。

回答by Guillermo Maschwitz

remove the hidden folder named .git from your Desktop

从桌面删除名为 .git 的隐藏文件夹

回答by azote

If you are a Comamnd Line Freak!You can also do it from your command prompt

如果你是一个命令行怪胎!您也可以从命令提示符执行此操作

  • Start --> Run

  • Type: cmd

  • Navigate to the folder of your project (ex: cd c:\myProject)

  • From the folder of your project you can type the following to be able to see the .git folder: attrib -s -h -r ./s /d

  • then you can just Delete the .git folder from the command line: del /F /S /Q /A .git

  • and rmdir .git

  • 开始 --> 运行

  • 类型:cmd

  • 导航到您的项目文件夹(例如:cd c:\myProject

  • 从项目的文件夹中,您可以键入以下内容以查看 .git 文件夹: attrib -s -h -r /s /d

  • 然后你可以从命令行删除 .git 文件夹:del /F /S /Q /A .git

  • rmdir .git

回答by Number8

Some suggestions:
- Make sure you are logged in with an admin account.
- Navigate, in Explorer, to "C:/User/my_user/".
- Right-click on 'Desktop' and select the 'Security' tab.
- Make sure 'my_user' has full control over the Desktop folder.
- Windows key->"Folder Options"->View: "Show hidden files, folders, and drives"
Now try to delete the .git dir and related files from Desktop (via command line or Explorer).

一些建议:
- 确保您使用管理员帐户登录。
- 在资源管理器中导航到“C:/User/my_user/”。
- 右键单击​​“桌面”并选择“安全”选项卡。
- 确保“my_user”完全控制桌面文件夹。
- Windows 键->“文件夹选项”->查看:“显示隐藏的文件、文件夹和驱动器”
现在尝试从桌面(通过命令行或资源管理器)删除 .git 目录和相关文件。

(Apologies if you have tried all these things, just trying to be thorough...)

(抱歉,如果你已经尝试了所有这些东西,只是想彻底……)

回答by aelmedani

Display the hidden folders: $ ls -alh. Remove the .git folder: $ rm -R .git

显示隐藏文件夹: $ ls -alh. 删除 .git 文件夹: $ rm -R .git

回答by Vasanth Umapathy

Go to your project directory and execute the following command on windows rmdir /s /q .gitthat will remove all of the git references.

转到您的项目目录并在 windows rmdir /s /q .git上执行以下命令, 这将删除所有 git 引用。

回答by Xuan Yue

^C[~ (master #)]$ ls -al | grep .git

You should see the following files: .git .gitconfig

您应该看到以下文件: .git .gitconfig

qc^C[~ (master #)]$ rm -rf .git

(recursively remove the .gitfile)

(递归删除.git文件)