当我试图在Windows上使用git Bash拉代码时,我有以下问题:

fatal: could not read Username for 'https://github.com': No such file or directory

我已经尝试实现这里提供的可接受的解决方案:

当推送提交Github时错误:致命:无法读取用户名

然而,问题仍然存在。

在添加/删除原点后,我仍然得到相同的错误。

你能给我一些建议吗?

谢谢!


当前回答

请检查以下内容

Android Studio ->首选项->版本控制-> Git ->使用凭据助手

其他回答

这是系统凭据缓存中存储的凭据的问题。你可能有配置变量“credential”。Helper '设置为wincred或winstore,它无法清除它。如果启动控制面板并启动凭据管理器applet,那么在标记为git:https://github.com的通用凭据部分中寻找项目。如果您删除了这些,那么下次将重新创建,但是凭据帮助实用程序将要求您提供新的凭据。

按照步骤在这里设置SSH密钥:https://help.github.com/articles/generating-ssh-keys

OR

git remote add origin https://{username}:{password}@github.com/{username}/project.git

更新:如果你得到"fatal: remote origin already exists.",那么你必须使用set-url:

git remote set-url origin https://{username}:{password}@github.com/{username}/project.git

我在这里找到了答案:

编辑~ /。并添加以下内容:

[url "git@github.com:"]
 insteadOf = https://github.com/

虽然它解决的问题不同,但错误代码是一样的…

请检查以下内容

Android Studio ->首选项->版本控制-> Git ->使用凭据助手

尝试使用普通的Windows shell,如CMD。