git push -u origin master报错(vscode)

Missing or invalid credentials.
Error: connect ECONNREFUSED /run/user/1000/vscode-git-e10c66c0ac.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
errno: -111,
code: ‘ECONNREFUSED’,
syscall: ‘connect’,
address: ‘/run/user/1000/vscode-git-e10c66c0ac.sock’
}
Missing or invalid credentials.
Error: connect ECONNREFUSED /run/user/1000/vscode-git-e10c66c0ac.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
参考:https://juejin.cn/post/7062237873570840589

问题描述

年后开工,修改代码后,像年前一样,在进行一些改变后进行git的提交。

git add .
git commit -m "xxxxxx"
复制代码

上述命令一切正常。

然而当我要进行push操作时,

git push -u origin main
复制代码

却出现了如下报错信息:

(picard) jxqi@han-server-01:~/text2sql/picard$ git push origin main
Missing or invalid credentials.
Error: connect ECONNREFUSED /run/user/1009/vscode-git-5020fb3c9f.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '/run/user/1009/vscode-git-5020fb3c9f.sock'
}
Missing or invalid credentials.
Error: connect ECONNREFUSED /run/user/1009/vscode-git-5020fb3c9f.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '/run/user/1009/vscode-git-5020fb3c9f.sock'
}
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/JiexingQi/picard.git/'

复制代码

解决方法

在网上查找了一些资料后发现是git的验证出了问题,但我在过年这段期间也没改过git的相关设置,就很奇怪。不过,还是找到了解决方法,步骤如下:

  1. 打开VScode的设置界面。方法即:“Code > Preferences > Settings”(我是Mac系统,Windows下应该是File > Preferences > Settings)

git push -u origin master报错(vscode)_第1张图片

  1. 搜索“git.terminalAuthentication”,并将该复选框前的对钩取消掉

git push -u origin master报错(vscode)_第2张图片

  1. 使用“command+shift+P”(Windows下为Ctrl+Shift+P)快捷键打开命令面板,输入”Reload Window“,点击该命令重新加载窗口。

git push -u origin master报错(vscode)_第3张图片

  1. 重新进行git push操作,顺利解决问题。
(picard) jxqi@han-server-01:~/text2sql/picard$ git push origin main
Counting objects: 11, done.
Delta compression using up to 96 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1.75 KiB | 1.75 MiB/s, done.
Total 11 (delta 9), reused 0 (delta 0)
remote: Resolving deltas: 100% (9/9), completed with 6 local objects.
To https://github.com/JiexingQi/picard.git
   335ff21..537c7f1  main -> main
(picard) jxqi@han-server-01:~/text2sql/picard$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
复制代码

参考

  1. Git push: Missing or invalid credentials. fatal: Authentication failed for ‘https://github.com/username/repo.git’
  2. VS Code 使用 Remote 连接服务器并 Push 到 GitHub 私有仓库时报错:Missing or invalid credentials. 的解决办法

作者:Q同学
链接:https://juejin.cn/post/7062237873570840589
来源:稀土掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

你可能感兴趣的:(计算机应用技术,git,github,vscode)