首页 \ 问答 \ 在Windows上卸载GIT(Uninstalling GIT on windows)

在Windows上卸载GIT(Uninstalling GIT on windows)

在过去的一年中,我在windows vista笔记本电脑上安装了各种msysgit,使用“msysGit-fullinstall”,“msysGit-netinstall”和“预览安装程序。此外,沿途安装/使用了不同的版本。我还有一个GIT二进制安装作为我的Cygwin包的一部分。我一路上搞砸了(实际上,我不能再编辑.gitconfig了),并决定去核并删除GIT让我有一个全新安装(我可以爱一点更多 :) )。

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

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

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

总之,我有一个拙劣的GIT窗口环境,所以如何清理它,以便我可以重新安装GIT!

谢谢。


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 :) ).

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

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:

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

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

Thanks.


原文:https://stackoverflow.com/questions/17702405
更新时间:2022-09-15 08:09

最满意答案

您的函数拦截必须始终返回Observable <HttpEvent <any >>。 你的代码有点“bizarro”。 我看到的主要问题是你使用“do”来捕获错误。 “不”修改请求。

我以这种方式截取(我希望代码可以帮助你)

constructor(private inj: Injector) { }

  intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
    //if the request has "Authorization" we return the request
    if (req.headers.has('Authorization'))
      return next.handle(req);

    //I get here the AuthService
    const auth = this.inj.get(AuthService);

    //create the httpHeaders
    const httpHeaders = new HttpHeaders()
      .set('Content-Type', 'application/json; charset=utf-8')
      .set('Authorization', '' + auth.SID) //<-- I use auth.SID

    const authReq = req.clone({ headers: httpHeaders });

    return next.handle(authReq).catch((err: any) => { //<--if error use a catch
      if (err instanceof HttpErrorResponse) {
        if (err.status === 401) {
          //auth.recoverSID return a Observable<{value:new SID}>
          //use switchMap to really return next.handle(authReq)
          return auth.recoverSID().switchMap((value: IResponse) => {
            let httpHeaders = new HttpHeaders()
              .set('Content-Type', 'application/json; charset=utf-8')
              .set('Authorization', '' + value.SID)

            const authReq = req.clone({ headers: httpHeaders });
            return next.handle(authReq);
          })
        };
      }
      //Other case throw an error
      return Observable.throw(err);
    });
  }

Your function intercept must return always a Observable < HttpEvent < any > >. Your code is a bit "bizarro". The main problem I see is that you use "do" to catch the error. "do" not modify the request.

I have a intercept in this way (I hope the code can help you)

constructor(private inj: Injector) { }

  intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
    //if the request has "Authorization" we return the request
    if (req.headers.has('Authorization'))
      return next.handle(req);

    //I get here the AuthService
    const auth = this.inj.get(AuthService);

    //create the httpHeaders
    const httpHeaders = new HttpHeaders()
      .set('Content-Type', 'application/json; charset=utf-8')
      .set('Authorization', '' + auth.SID) //<-- I use auth.SID

    const authReq = req.clone({ headers: httpHeaders });

    return next.handle(authReq).catch((err: any) => { //<--if error use a catch
      if (err instanceof HttpErrorResponse) {
        if (err.status === 401) {
          //auth.recoverSID return a Observable<{value:new SID}>
          //use switchMap to really return next.handle(authReq)
          return auth.recoverSID().switchMap((value: IResponse) => {
            let httpHeaders = new HttpHeaders()
              .set('Content-Type', 'application/json; charset=utf-8')
              .set('Authorization', '' + value.SID)

            const authReq = req.clone({ headers: httpHeaders });
            return next.handle(authReq);
          })
        };
      }
      //Other case throw an error
      return Observable.throw(err);
    });
  }

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。