VS Code 使用 Remote 连接服务器并 Push 到 GitHub 私有仓库时报错:Missing or invalid credentials. 的解决办法

1、错误信息

Missing or invalid credentials.
Error: connect ECONNREFUSED /run/user/0/vscode-git-02xxxeed11.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '/run/user/0/vscode-git-02xxxeed11.sock'
}
Missing or invalid credentials.
Error: connect ECONNREFUSED /run/user/0/vscode-git-02xxxeed11.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '/run/user/0/vscode-git-02xxxeed11.sock'
}
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/username/repo.git/'

2、解决办法
参考文章:Git push: Missing or invalid credentials. fatal: Authentication failed for ‘https://github.com/username/repo.git’
① 依次选择:文件 -> 首选项 -> 设置
选择
② 搜索 git.terminalAuthentication 并取消勾选:
取消勾选
③ 重启 VS Code 并重新 Push:
重启

这样操作之后有一个坏处,就是你 VS Code 对 GitHub 认证信息保存的功能会失效,你的每次 Push 都必须输入用户和密码。

结束。