在 Windows 上卸载 GIT

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17702405/
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:35:01  来源:igfitidea点击:

Uninstalling GIT on windows

gitcygwinuninstall

提问by Damo

I have had various msysgit installs on my windows vista laptop over the past year, using the "msysGit-fullinstall", "msysGit-netinstall" and "preview installers. Also, installed / used different versions along the way. I also had a GIT binary installed as part of my Cygwin package. I screwed up along the way (actually, I could not edit .gitconfig anymore), and decided to go nuclear and remove GIT to allow me the have a fresh install (which I can love a bit more :) ).

在过去的一年里,我在我的 windows vista 笔记本电脑上安装了各种 msysgit,使用“msysGit-fullinstall”、“msysGit-netinstall”和“预览安装程序”。此外,安装/使用了不同的版本。我也有一个 GIT二进制安装为我的 Cygwin 包的一部分。一路上我搞砸了(实际上,我无法再编辑 .gitconfig),并决定去核并删除 GIT 以允许我重新安装(我有点喜欢更多的 :) )。

I tried the below steps, but still the build fails with the error "Old version git-* commands still remain in bindir" - when attempting to use the net installer. - I removed GIT through Add / Remove programs in control - Removed all GIT files from usr/local/bin - and every other "git" file I could find - I even removed my Cygwin enviorment - My current %HOME% directory is empty

我尝试了以下步骤,但在尝试使用网络安装程序时,构建仍然失败,并显示错误“旧版本的 git-* 命令仍然保留在 bindir”。- 我通过添加/删除控制程序删除了 GIT - 从 usr/local/bin 中删除了所有 GIT 文件 - 以及我能找到的所有其他“ git”文件 - 我什至删除了我的 Cygwin 环境 - 我当前的 %HOME% 目录是空的

If I chose to install via the "preview" or "full" installers, it works, can I can use the GIT env / commands - except I again cannot edit the .gitconfig file, and get the error message:

如果我选择通过“预览”或“完整”安装程序进行安装,它可以工作,我可以使用 GIT env / 命令吗 - 除非我再次无法编辑 .gitconfig 文件,并收到错误消息:

"error: could not lock config file .git/config: No such file or directory"

“错误:无法锁定配置文件 .git/config:没有这样的文件或目录”

In summary, I have a botched GIT windows env, so how can I clean it such that I can reinstall GIT!

总之,我有一个拙劣的 GIT windows env,那么我该如何清理它以便我可以重新安装 GIT!

Thanks.

谢谢。

采纳答案by Sergey K.

There are two steps that you have to do to manually "uninstall" git on Windows:

在 Windows 上手动“卸载”git 需要执行两个步骤:

  1. You have to remove all paths to your binfolders from your PATHenvironment variable
  2. Remove folder where your git/Cygwin are installed.
  1. 您必须binPATH环境变量中删除文件夹的所有路径
  2. 删除安装了 git/Cygwin 的文件夹。

After that you can install Cygwin-less msysgitfrom here: http://code.google.com/p/msysgit/downloads/list

之后,您可以msysgit从这里安装 Cygwin-less :http: //code.google.com/p/msysgit/downloads/list

回答by WebViewer

Here is my approach to this (withoutremoving CygWin):

这是我的方法(删除 CygWin):

  1. first, verify Git is installed by typing 'git status' from Cygwin64 Terminal.
  1. 首先,通过从 Cygwin64 终端输入“git status”来验证 Git 是否已安装。

Now... Run cygwin-1-7-33\setup-x86_64.exe (or any other cygwin version's setup.exe):

现在...运行 cygwin-1-7-33\setup-x86_64.exe(或任何其他 cygwin 版本的 setup.exe):

> Install from local directory.
> Took default installation Options:
  * Root Directory: C:\cygwin64
  * Install for: All Users
  * Default Text File Type: DOS
> Local Package Directory:
   ...\cygwin-1-7-33
> Select Packages:
  Leave as is ("+All <-> Install") for most, except for removing the 4 git packages:
    > Scroll down to Devel:
      > Check the Bin column of all packages that start with 'git-' 
        (by clicking the 'New' column) - change from 'Keep' to '**Uninstall**':
        - git: Fast Version Control System - core files
        - git-completion: Fast Version Control System - git bash completion
        - git-gui: Fast Version Control System - git-gui viewer
        - gitk: Fast Version Control System - gitk viewer               
> Create Icons:
  No to icon on destop and start menu. (it's already there)

Now, verify Git is NOT installed by typing 'git status' from Cygwin64 Terminal:

现在,通过从 Cygwin64 终端输入“git status”来验证 Git 未安装:

~/ws> -bash: git: command not found

回答by Damo

So I had to re-install Cygwin, with the git package selected. Simply could not get the msysgit to work. Initially, all git commands worked, except I STILL could not edit the .gitconfig file. This was solved by:

所以我不得不重新安装 Cygwin,并选择了 git 包。根本无法让 msysgit 工作。最初,所有 git 命令都有效,除了我仍然无法编辑 .gitconfig 文件。这是通过以下方式解决的:

  1. mkdir ~/.git
  2. git config --global user.email "[email protected]"
  1. mkdir ~/.git
  2. git config --global user.email "[email protected]"