我正在使用 Visual Studio 和 GitHub 扩展。我能够登录,然后克隆我团队的存储库,然后成功 pull 更改。
当需要将我的更改推送回远程时,我在屏幕上短暂出现一个空白命令提示符,然后在输出窗口中出现以下错误:
Error encountered while pushing to the remote repository: Git failed with a fatal error.
fatal: AggregateException encountered. One or more errors occurred.
error: cannot spawn askpass: No such file or directory
fatal: could not read Username for 'https://github.com': terminal prompts disabled
编辑:通过命令行推送和通过 GitHub 桌面应用程序推送一样有效,只是不在此扩展中。
知道为什么会发生这种情况吗?鉴于我已登录扩展程序,我不明白为什么它需要用户名。
最佳答案
根据我的评论。您可以在远程 URL 中包含您的用户名(类似于 FTP)。
没有密码的例子(SSH):
git remote set-url origin git@github.com/username/repo.git
密码示例 (https)
https://name:password@github.com/username/repo.git
来源:Git push requires username and password
更新于 5/14/2018 以将原始答案中的 github.org
更正为 github.com
关于git - 尝试推送 git 并接收 "could not read Username for ' https ://github. com':终端提示已禁用”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42915793/