致命:无法读取“https //github.com”设备未配置的用户名

问题描述 投票:0回答:11

我正在尝试使用 SublimeGit 插件将代码推送到 github,但我遇到了一些奇怪的事情。

推送到https://github.com/username/username.github.io.git

致命:无法读取“https://github.com”的用户名:设备未配置

在询问之前进行了大量搜索,例如fatal: could not read Username for 'https://github.com': No such file or directory, Fatal: could not read Username for 'https:// github.com': 没有这样的设备或地址.

但问题仍然存在,任何努力将不胜感激。

git sublimetext3 sublime-text-plugin
11个回答
77
投票

苹果操作系统: Android Studio Preferences -> Git -> 在底部,使用 Credentials helper(确保它被选中)

窗户: Android Studio File -> Settings -> Git -> Check Credentials Helper 在底部


58
投票

fatal: could not read Username for 'https://github.com': Device not configured
需要询问用户名或密码时,您会收到该错误 (
git
),并且 (a) 唯一可用的机制是在控制台上询问,并且 (b) 没有可用的控制台(git 是未连接到 tty 设备,即您没有以交互方式运行
git
)。

这通常发生在您从某种 gui 工具调用 git 并且没有配置适当的凭证助手的环境中。

有多种方法可以解决这个问题:

  • 最简单的方法之一是转向使用

    ssh
    身份验证而不是
    https
    .

  • 您可以将 github 的凭据硬编码到本地 git 存储库中,如 gitcredentials 文档中所述。

  • 您可以配置适当的辅助应用程序。一个可能已经配置好了,但是

    git
    可能就是找不到。 gitcredentials 手册页也有关于此选项的信息。


11
投票

我刚刚关闭了Android Studio并重新启动它。问题已解决。


3
投票

@codrus 的评论帮助我解决了 sourcetree 上的问题 转到首选项 -> 选项卡 Git -> 部分 Git 版本 -> 按钮使用系统 Git,然后从对话框中选择“git”。


2
投票

这个 Gist 帮助很大!只需 3 个命令。


1
投票

在 Android Studio File -> Settings -> Git -> Credentials Helper 中勾选这个选项

如果在设置中选中“Credentials helper”后仍然无法正常工作,则只能重新启动 Android Studio 并再次尝试推送代码。


1
投票

我重新启动了 Android Studio,它对我有用


0
投票

在 Mac 上为 github 更新钥匙串访问条目对我有用。

参考这个答案有关如何更新钥匙串访问条目的详细信息。


0
投票

这应该有助于解决这个问题,因为对密码身份验证的支持已于 2021 年 8 月 13 日被删除。请下载并安装 Git Credential Manager:https://github.com/GitCredentialManager/git-credential-manager/releases/tag/ v2.0.785 然后您可以使用 Android Studio 并推送所有更改。推送后,Git Credential Manager 会要求您进行验证,毕竟一切都应该完美无缺。


-1
投票

如果可能是这种情况,您的存储库是私有的, 像上面那样在 by git reference 中添加依赖项时,在 pubspec.yaml.

若是Private repo要解决:

  1. 在 Github 中选择你的 Github 项目。
  2. 转到最后一个选项卡设置
  3. 在常规菜单中,滚动到按钮和功能下方的危险区域
  4. 更改可见性并公开。

如果您使用私有仓库作为 pubspec 依赖项,这将很有帮助。由于 pub.dev 中的所有回购都是公开的。


-2
投票

对我来说,只需安装适用于 Mac 的 Github 客户端即可解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.