Git——git push 错误[error: src refspec master does not match any]解决方案

问题描述 

git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/XXX/XXX.git'

问题分析

1.本地git仓库目录下为空

2.本地仓库add后未commit

3.git init错误

4.没有git add添加文件

解决方案

1.控制面板打开文件夹选项  打开隐藏文件和文件夹显示

2.到本地仓库目录下查看是否有.git文件夹——无 则git init

3.看.git文件夹下是否有之前提交的文件——若无 则重新 git commit

注:如果之前git add过的话 没有就要重新 add commit

4.新装的git要留意是否需要配置用户名和邮箱名

5.git status检查是否有添加文件,git add添加文件

参考文章

https://blog.csdn.net/qq_38198952/article/details/82792279

https://blog.csdn.net/wangwangwanglichao/article/details/79983262

https://blog.csdn.net/z000123456789/article/details/100622482

发布了1345 篇原创文章 · 获赞 226 · 访问量 28万+

猜你喜欢

转载自blog.csdn.net/weixin_43272781/article/details/103889078