Windows缓存SSH密钥? [英] Does Windows cache SSH keys?

查看:586
本文介绍了Windows缓存SSH密钥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近发布了一个关于Git Bash引用旧GitHub帐户用户名的问题。请参考这篇文章:



,您的详细信息由您的Windows登录保护,并可以保留多个会话。这是在Git for Windows 1.8.1.1中添加的。



所以:


  1. 尝试使用以下方法清除HTTPS克隆的回购的凭证缓存,然后重试: git凭证-osxkeychain擦除主机= github.com协议= https


或,


  1. 使用Windows控制面板的凭证管理器编辑凭证。

然后尝试再次推送到您的HTTPS克隆存储库当你应该再次提示认证细节。


I recently posted a question regarding Git Bash referencing an old GitHub account username. Refer to that post here: Original Post

Now I'm completely convinced that Windows is somehow storing my ssh info and using that for my Git bash session. When ever I try to push to a remote repo, it keeps stating that

remote: Permission to MYUSERNAME/project.git denied to OLD-USER-NAME

I've changed everything I could. I have searched every directory I could looking for any reference of my old username and can't find anything. I have repeated the SSH key generation process at least 3 times with no luck. Why does it keep bringing up my old username?

So my question, does Windows have some type of caching system for ssh keys? Even though I am explicitly loading my new key, it keeps bringing up reference to my old user name. The only thing I can think is that my ssh agent isn't using my new key, and then when it attempts to connect to github, it sees the old key and associates it with my old username. But again, it doens't make sense due to the fact that I deleted the old key from my old GitHub account...

I'm about to kill Git..

解决方案

I think the key here is that you might be using HTTPS to clone the new repository which in turn does not use the SSH keys at all for authentication.

I suspect that your credentials are being cached by the credentials helper. See this:

https://help.github.com/articles/caching-your-github-password-in-git/#platform-windows

On windows, if you've used the wincred helper (git config --global credential.helper wincred), then this stores your credentials in the Windows credential store which has a Control Panel interface where you can delete or edit your stored credentials. See this for instance:

With this store, your details are secured by your Windows login and can persist over multiple sessions. This was added in Git for Windows 1.8.1.1.

So either:

  1. Try clearing the credential cache for your https cloned repo using the following and try again:

    git credential-osxkeychain erase host=github.com protocol=https

OR,

  1. Edit the credentials using the Windows control panel's Credential Manager.

And then try pushing to your HTTPS-cloned repository again when you should get prompted for authentication details again.

这篇关于Windows缓存SSH密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆