首页 > 解决方案 > 无法提交或推送到 github,而且我没有启用 2 因素身份验证

问题描述

我收到“无效的用户名或密码”错误。

此外,我收到我的身份验证失败的消息。

试图推动:

error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/theseareprojects/testproject.git'

远程验证:

origin  https://github.com/theseareprojects/testproject.git (fetch)
origin  https://github.com/theseareprojects/testproject.git (push)

验证自己的信息:

user.email=theseareprojects@protonmail.com
user.name=theseareprojects
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://github.com/theseareprojects/testproject.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

我的信息是正确的...

大声笑这有点卡住了,所以谢谢你的帮助。我什至没有启用 2 因素身份验证。这让我困惑了很长一段时间。

标签: linuxgitgithub

解决方案


我认为你错过了一次提交。一步一步尝试,

git add .
git commit -m "initial project commit"
git push origin master

但是,如果已经提交,您也可以尝试以下作为本地参考独立解决方案。这表示您希望将本地HEADref 推送到远程masterref。

git push origin HEAD:master

推荐阅读