Git:错误:error:src refspec master does not match any

简介: 新建立了一个远程仓库,想着把项目放上去。于是在项目目录上: git init 然后就添加远程库 git remote add origin xxxx.git 然后就想push: git push -u origin master 结果提示错误: error:src refspec master does not match any 百度下,原来是说我本地没有提交任何东西,本地版本库为空, 空目录不能提交 (只进行了init, 没有add和commit)。

新建立了一个远程仓库,想着把项目放上去。于是在项目目录上:

git init

然后就添加远程库

git remote add origin xxxx.git

然后就想push:

git push -u origin master

结果提示错误:

error:src refspec master does not match any

百度下,原来是说我本地没有提交任何东西,本地版本库为空, 空目录不能提交 (只进行了init, 没有add和commit)。

解决:

添加:git add -A

提交:git commit -m "first commint"

强制推送:git push -f orgin master

注:之所以强制推送是因为远程仓库已经初始化了,而我没有pull下来就直接push会提示版本不一致。使用-f表示强制推送,覆盖掉原仓库。

 





唯有不断学习方能改变! -- Ryan Miao
目录
相关文章
|
安全 网络安全 开发工具
git 提示:fatal: Could not read from remote repository.
git 提示:fatal: Could not read from remote repository.
640 0
git 提示:fatal: Could not read from remote repository.
|
缓存 开发工具 git
报错:Git上传代码报错 will not add file alias already exists in index
报错:Git上传代码报错 will not add file alias already exists in index
395 0
|
3月前
|
网络安全 开发工具 git
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
21 0
|
开发工具 git
git报错error: failed to push some refs to ‘https://gitee.com/XXX/XXX-mater.git‘
git报错error: failed to push some refs to ‘https://gitee.com/XXX/XXX-mater.git‘
git报错error: failed to push some refs to ‘https://gitee.com/XXX/XXX-mater.git‘
|
7月前
|
Shell BI 开发工具
【问题解决】Git报错:failed to push some refs to xxxxx
Git报错:failed to push some refs to xxxxx
124 0
|
11月前
|
开发工具 git
Git 提示error:src refspec master does not match any
Git 提示error:src refspec master does not match any
90 0
|
存储 开发工具 git
git 删除远程分支报错error: unable to delete ‘origin/xxx‘: remote ref does not exist
git 删除远程分支报错error: unable to delete ‘origin/xxx‘: remote ref does not exist
234 0
git 删除远程分支报错error: unable to delete ‘origin/xxx‘: remote ref does not exist
|
Linux 开发工具 git
Git问题:git add . 时出现warning: LF will be replaced by CRLF in ...... 解决办法
Git问题:git add . 时出现warning: LF will be replaced by CRLF in ...... 解决办法
124 0
Git问题:git add . 时出现warning: LF will be replaced by CRLF in ...... 解决办法
|
开发工具 git
Git Pull Failed 解决办法
Git Pull Failed 解决办法
Git Pull Failed 解决办法
|
开发工具 git Windows
【Git】git clone 报错:fatal: index-pack failed 解决办法
【Git】git clone 报错:fatal: index-pack failed 解决办法

相关实验场景

更多