我试图在新的MacBook上进行首次尝试,并在git push
后收到此错误(在我的旧MacBook上一切正常):
Missing or invalid credentials.
Error: connect ECONNREFUSED /var/folders/tx/53fffl0j51qb47mhnlf8zsdc0000gn/T/vscode-git-1d38026c7f.sock
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '/var/folders/tx/53fffl0j51qb47mhnlf8zsdc0000gn/T/vscode-git-1d38026c7f.sock'
}
Missing or invalid credentials.
Error: connect ECONNREFUSED /var/folders/tx/53fffl0j51qb47mhnlf8zsdc0000gn/T/vscode-git-1d38026c7f.sock
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '/var/folders/tx/53fffl0j51qb47mhnlf8zsdc0000gn/T/vscode-git-1d38026c7f.sock'
}
remote: No anonymous write access.
fatal: Authentication failed for 'https://github.com/username/repo.git/'
知道为什么以及如何解决吗?
最佳答案
如marpo-it的answer中所述,可以不选中设置git.terminalAuthentication
(since VSCode 1.45)
这样可以避免这种情况,对于在集成终端中调用的Git命令(例如git push
),您将自动根据GitHub帐户进行身份验证。
原始答案:
I have set up credentials by using git config user.name "your username" and git config user.password "your password", and could see these by running
git config --list
, what am I missing here?
这些不是“凭证”:它们不会帮助您通过GitHub之类的远程服务进行身份验证。
对于HTTPS URLS(
https://github.com/<me>/<myRepo>
),您需要:git config --global credential.helper osxkeychain
)在此输入您的实际凭证:
但是,如果问题今天消失了,那就是linked to this GitHub incident。
Andreas L还提到in the comments,尝试从集成的VS Code终端进行身份验证可能很棘手。
如
git push origin master
Missing or invalid credentials和here中所述:If you work with the JSON-settings file, insert the following line into it:
git.terminalAuthentication: false,
关于Git push : Missing or invalid credentials.致命: 'https://github.com/username/repo.git'身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62860280/