问题背景
在某一次的Git推送时,配置好commit信息之后,执行push操作的时候出现了这样的一个报错信息:
$ git push
fatal: could not read Username for 'https://gitee.com': terminal prompts disabled
fatal: could not read Username for 'https://gitee.com': terminal prompts disabled
Missing or invalid credentials.
Error: connect ECONNREFUSED /tmp/vscode-git-a7309d2889.sockat PipeConnectWrap.afterConnect [as oncomplete] (node:net:1607:16) {errno: -111,code: 'ECONNREFUSED',syscall: 'connect',address: '/tmp/vscode-git-a7309d2889.sock'
}
Missing or invalid credentials.
Error: connect ECONNREFUSED /tmp/vscode-git-a7309d2889.sockat PipeConnectWrap.afterConnect [as oncomplete] (node:net:1607:16) {errno: -111,code: 'ECONNREFUSED',syscall: 'connect',address: '/tmp/vscode-git-a7309d2889.sock'
}
remote: [session-684eb69f] Unauthorized
fatal: Authentication failed for 'https://gitee.com/xxx.git/'
经过一番检索,有人说是授权的问题,需要重新配置user.name
和user.email
,还有一些环境变量,但是试了几个方案都没有生效。后来在SO(参考链接1)上面找到了一个可以work的解决方案。
解决方案
在VSCode中找到文件-首选项-设置
,然后搜索git.terminalAuthentication
,然后取消选中:
再重启一下VSCode的Terminal,再重新push,经测试可以推送。
总结概要
版权声明
本文首发链接为:https://www.cnblogs.com/dechinphy/p/git-auth.html
作者ID:DechinPhy
更多原著文章:https://www.cnblogs.com/dechinphy/
请博主喝咖啡:https://www.cnblogs.com/dechinphy/gallery/image/379634.html
参考链接
- https://stackoverflow.org.cn/questions/62860280