问题
当本地或服务器上vs code提交仓库时发生**remote: No anonymous write access.**报错。 即
git push -u origin main
报错信息如下:
Missing or invalid credentials. Error: connect ECONNREFUSED /run/user/1000/vscode-git-3a7cb34ff8.sock at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) { errno: -111, code: ‘ECONNREFUSED’, syscall: ‘connect’, address: ‘/run/user/1000/vscode-git-3a7cb34ff8.sock’ } Missing or invalid credentials. Error: connect ECONNREFUSED /run/user/1000/vscode-git-3a7cb34ff8.sock at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) { errno: -111, code: ‘ECONNREFUSED’, syscall: ‘connect’, address: ‘/run/user/1000/vscode-git-3a7cb34ff8.sock’ } remote: No anonymous write access. fatal: ‘https://github.com/xxx/xxx.git/’ 鉴权失败
解决方法
一种更简单的方法是在 GitHub 上使用个人访问令牌。可以通过转到您的 GitHub 帐户 →设置→开发人员设置→个人访问令牌→生成个人访问令牌来设置此功能。进行访问控制选择,生成,然后复制并保存您的新令牌。在此之后,转到您的 Git 项目目录,然后在终端中输入:
git remote set-url origin https://YOUR_TOKEN_HERE@github.com/your_user/your_project.git
从现在开始,您可以git push从终端或 Visual Studio Code 轻松完成。
|