知识站

 找回密码
 立即注册
知识站 首页 git 查看内容

git push 失败出现error: src refspec master does not match any.解决方案

2020-1-28 11:19| 发布者: admin| 查看: 110| 评论: 2|来自: csdn

摘要: 今天写好一个demo往GitHub上传时报错错误提示:error: src refspec master does not match any.error: failed to push some refs to找了下原因,原来是git commit -m "xxx" 时没留意,因为新装的git需要提交用户邮箱和 ...
今天写好一个demo往GitHub上传时报错

错误提示:

error: src refspec master does not match any.

error: failed to push some refs to 

找了下原因,原来是git commit -m "xxx" 时没留意,因为新装的git需要提交用户邮箱和用户名,

所以没有委托成功,本地仓库是空的,所以配置了下邮箱和用户名才成功,真是粗心不得啊!!!

*** Please tell me who you are.

Run

 git config --global user.email "you@example.com"

 git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.


分析:

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

2.本地仓库add后未commit

3.git init错误



解决方法:

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

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

3.看.git文件夹下是否有之前提交的文件——若无 则重新 git commit (如果之前git add过的话 没有就要重新 add commit)

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

最新评论

aixin 2020-2-17 00:09
abbb
admin 2020-2-16 23:55
abc

查看全部评论(2)

Archiver|知识站 ( 鲁ICP备20004068号-1 )

鲁公网安备 37132502371390号

GMT+8, 2020-9-14 21:49 , Processed in 0.014045 second(s), 17 queries .

返回顶部