当我试图在Windows上使用git Bash拉代码时,我有以下问题:
fatal: could not read Username for 'https://github.com': No such file or directory
我已经尝试实现这里提供的可接受的解决方案:
当推送提交Github时错误:致命:无法读取用户名
然而,问题仍然存在。
在添加/删除原点后,我仍然得到相同的错误。
你能给我一些建议吗?
谢谢!
当我试图在Windows上使用git Bash拉代码时,我有以下问题:
fatal: could not read Username for 'https://github.com': No such file or directory
我已经尝试实现这里提供的可接受的解决方案:
当推送提交Github时错误:致命:无法读取用户名
然而,问题仍然存在。
在添加/删除原点后,我仍然得到相同的错误。
你能给我一些建议吗?
谢谢!
当前回答
请检查以下内容
Android Studio ->首选项->版本控制-> Git ->使用凭据助手
其他回答
我通过安装新版本的Git解决了这个问题。我从https://git-scm.com安装的版本是2.10.2。查看最后一篇文章:https://www.bountysource.com/issues/31602800-git-fails-to-authenticate-access-to-private-repository-over-https
在更新的Git Bash中,凭证管理器窗口会弹出,您可以输入您的用户名和密码,它就可以工作了!
当试图克隆无效的HTTP URL时,也会发生此错误。例如,这是我在试图克隆一个GitHub URL时得到的错误,这是几个字符:
$ git clone -v http://github.com/username/repo-name.git
Cloning into 'repo-name'...
Username for 'https://github.com':
Password for 'https://github.com':
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/username/repo-name.git/'
但是,它实际上发生在Emacs内部,所以Emacs中的错误看起来是这样的:
fatal: could not read Username for ’https://github.com’: No such device or address
因此,它没有给出一个有用的错误,告诉我那个URL上没有这样的回购,而是给了我这个错误,让我徒劳地追逐,直到我最终意识到URL是错误的。
这是git 2.7.4版本。
我在这里张贴这个,因为一个月前发生在我身上的事情,刚刚又发生了一次,让我再次陷入同样的徒劳。>:(
这是系统凭据缓存中存储的凭据的问题。你可能有配置变量“credential”。Helper '设置为wincred或winstore,它无法清除它。如果启动控制面板并启动凭据管理器applet,那么在标记为git:https://github.com的通用凭据部分中寻找项目。如果您删除了这些,那么下次将重新创建,但是凭据帮助实用程序将要求您提供新的凭据。
对于我来说,上面建议的没有任何工作,我使用了Jenkins Shell Script中的git pull命令,显然它需要错误的用户名。我花了很长时间才找到一种不切换到SSH的方法来修复它。
在你的用户文件夹中创建。gitconfig文件(如果你还没有的话),并把你的凭证放在以下格式:https://user:pass@example.com,更多信息。在你的.gitconfig文件链接到这些凭证之后,在我的情况下,它是:
[credential]
helper = store --file /Users/admin/.git-credentials
现在git无论如何都会使用这些凭证。我希望它能帮助别人,就像它帮助了我一样。
请检查以下内容
Android Studio ->首选项->版本控制-> Git ->使用凭据助手