error: src refspec master does not match any error:failed to push some refs to 'git@github.com:xxxx

AddTime 2022/12/18 Hits 8981

在有了本地仓库需要建立一个github仓库,并让这两个仓库进行远程同步,首次向远程同步代码时出现问题

git push -u origin master 出现问题:

error: src refspec master does not match any
error: failed to push some refs to 'git@github.com:xxxxxxxx/xxx.git'

原因:

如果创建远程仓库的时候,没有勾选创建 README.md 的情况:暂存区还没有任何内容就向远程库进行提交,空的暂存区时不能提交上去的,需要至少有一次 add ?和 commit

解决:

git add .
git commit -m "commit all local code to origin"
git push -u origin master


小珂爱学习(XkWeb)
© 2020 Xkweb.cn. 小珂爱学习 让知识变得有趣 冀ICP备13014724号-2
Designed by:Xkweb3.6