git - 尝试推送 git 并接收 "could not read Username for ' https ://github. com':终端提示已禁用”

标签 git visual-studio github

我正在使用 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/

相关文章:

git - 如何获得多个作者的提交?

Git fetch 给出 "cannot lock ref"错误消息,但似乎仍然有效

visual-studio - 在没有管理员权限的情况下运行 Visual Studio

html - 在 github 配置文件 README 中显示图像?

git - Jenkins 和 Git : Monitor specific folder on any branch

git - Meteor:从 Github 克隆存储库时出错

node.js - Heroku 托管 Microsoft Bot Framework 聊天机器人无法正常工作

mysql - 切换分支时如何恢复相同的数据库?

c++ - 在 VS cmd 提示符下运行 .bat 文件

visual-studio-2010 - 无法加载“Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior”