git 致命:无法读取未配置“https //github.com”设备的用户名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40274484/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fatal: could not read username for 'https //github.com' device not configured
提问by Tangoo
I am trying to push code to github with SublimeGit plugin, but something weird occurs to me.
我正在尝试使用 SublimeGit 插件将代码推送到 github,但我发生了一些奇怪的事情。
Pushing to https://github.com/username/username.github.io.git
fatal: could not read Username for 'https://github.com': Device not configured
推送到https://github.com/username/username.github.io.git
致命:无法读取“ https://github.com”的用户名:设备未配置
Have been taken a lot of search before asking, like fatal: could not read Username for 'https://github.com': No such file or directory, Fatal: could not read Username for 'https://github.com': No such device or address.
在询问之前已经进行了大量搜索,例如致命:无法读取“https://github.com”的用户名:没有这样的文件或目录,致命:无法读取“https://github.com”的用户名: 没有这样的设备或地址。
But problem still remains, any effort will be appreciated.
但问题仍然存在,任何努力将不胜感激。
回答by larsks
You get that error (fatal: could not read Username for 'https://github.com': Device not configured
) when git
needs to ask for a username or password and (a) the only mechanism available to it is to ask on the console and (b) there is no console available (git is not attached to a tty device, i.e., you're not running git
interactively).
fatal: could not read Username for 'https://github.com': Device not configured
当git
需要询问用户名或密码时,您会收到该错误 ( ),并且 (a) 唯一可用的机制是在控制台上询问,并且 (b) 没有可用的控制台(git 未连接到 tty 设备,即,您不是以git
交互方式运行)。
This commonly happens in an environment where you are invoking git from some sort of gui tool and no appropriate credentials helper has been configured.
这通常发生在您从某种 gui 工具调用 git 并且没有配置适当的凭据帮助程序的环境中。
There are a variety of ways of addressing this problem:
有多种方法可以解决这个问题:
One of the easiest is to move to using
ssh
authentication rather thanhttps
.You could hardcode the credentials for github into your local git repository, as described in the gitcredentialsdocumentation.
You could configure an appropriate helper application. One may already be configured, but
git
may simply not be able to find it. The gitcredentialsman page has information on this option as well.
最简单的方法之一是改用
ssh
身份验证而不是https
.您可以将 github 的凭据硬编码到本地 git 存储库中,如gitcredentials文档中所述。
您可以配置适当的帮助应用程序。一个人可能已经配置好了,但
git
可能根本无法找到它。该gitcredentials手册页对这一选项的信息也是如此。