在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
最满意答案
您的函数拦截必须始终返回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); }); }
相关问答
更多-
瓦斯科! 你好吗? 我使用了类似于此链接中使用的方法: https : //github.com/dougmoscrop/angular-img-http-src/blob/master/index.js 我将部分内容添加到我的控制器中: function SampleCtrl($scope, $http) { $scope.ImageUrl = ''; // this method can be on a service ($http or $resource) $scope.g ...
-
OAuth2 - 检索TOKEN时OPTIONS请求的状态401(OAuth2 - Status 401 on OPTIONS request while retrieving TOKEN)[2022-05-28]
我可以在理论上回答你的问题: 那么为什么来自/ oauth / token响应的OPTIONS请求具有401状态,即使它不应该? 它不会让我们自己授权,因为它会停留在我们无法添加授权标头的OPTIONS请求中。 这是因为AuthServer的默认配置是仅允许在令牌端点处进行完全身份验证的请求。 在您的资源服务器中,您允许所有请求在未经身份验证的情况下发生: http.authorizeRequests().anyRequest().permitAll(); 我试图像这里提到的那样解决这种情况,但是我无法为我 ... -
我很高兴你喜欢我的解决方案。 我将在这里提出最终解决方案,但是如果有人想知道我允许的过程请到这里: 刷新令牌OAuth身份验证Angular 4+ 好的,首先我创建了一个服务来保存刷新令牌请求的状态,并创建了Observable来知道请求何时完成。 这是我的服务: @Injectable() export class RefreshTokenService { public processing: boolean = false; public storage: Subject
= new ... -
如果有人遇到类似的问题。 以下是解决方案: JDBCTokenStore存在问题。 我不得不创建一个受保护的内部类来扩展JdbcTokenStore并定义我自己的readAccessToken()方法。 这解决了这个问题。 In case anyone is stuck with a similar problem. Below is the solution: There was a problem in the JDBCTokenStore. I had to create a protected in ...
-
首次成功通过服务器验证时,我们将{access_token,expires_in,refresh_token}。 我们将access_token和expires_in 存储在会话存储中,并将refresh_token存储在本地存储中。 每当获取access_token以获取数据时(你应该使用fill_token填充来增强/包装fetch),你将检查expires_in是否即将到期(不到1分钟,或你感觉舒服),然后我们使用refresh_token请求新的的access_token。 当然,我们还必须将新结果 ...
-
consumer_key_rejected表示您没有向Yahoo提供有效的consumer_key 。 如果您确实向Yahoo提供了正确的consumer_key ,您可以检查您在雅虎的应用注册。 您可能需要至少检查一下雅虎提供的一项或多项服务。 不要忘记选择应用程序的类型,无论是基于Web还是基于客户端。 这一切都有意义,因为雅虎将权限范围包含在消费者密钥中。 阅读此说明以获取更多详细信息: Yahoo OAuth Scope 。 这是解决您的问题可能有用的解决方法示例和提示: Yahoo OAuth问题 ...
-
您的函数拦截必须始终返回Observable
>。 你的代码有点“bizarro”。 我看到的主要问题是你使用“do”来捕获错误。 “不”修改请求。 我以这种方式截取(我希望代码可以帮助你) constructor(private inj: Injector) { } intercept(req: HttpRequest , next: HttpHandler): Observable > { //if the reques ... -
我找到了答案并希望与其他人分享(可能陷入类似情况)。 首先,如果您使用路标库进行oauth,我建议您停止使用它。 因为,自2011年1月以来,开发已经停止。请阅读: http : //brainflush.wordpress.com/2011/01/27/stepping-back-from-signpost-development/ 我为此使用'scribe-java'。 这是github上的链接。 您可以使用maven或下载jar或只是分叉代码。 https://github.com/fernandez ...
-
首先,确保从原始get_access_token调用中保存oauth_session_handle参数。 然后,当您要刷新access_token时,请执行以下操作: request_token = OAuth::RequestToken.new(consumer, config["ACCESS_TOKEN"], conf ...
-
OAuth给了我401错误(OAuth gives me 401 error)[2022-02-24]
我遇到了完全相同的问题。 更换: STDIN.gets 有: pin = (gets.chomp).to_i to_i转换为整数,该整数也用于剥离空格。 然后,您需要在尝试获取访问令牌时指定引脚。 如果您不这样做,则没有证据表明用户已允许您的申请。 access_token = request_token.get_access_token(:oauth_verifier => pin) puts "Access Token : " + access_token.token puts "Access ...