首页 > git push 原始分支报错src refspec xxx does not match any

git push 原始分支报错src refspec xxx does not match any

首先这是一个别人做的项目 我现在要进行迭代

操作顺序如下
git config --global user.email ""
git config --global user.name ""
初次提交将其提交到本地仓库
git add .
git commit
提交到远程仓库
git remote add origin git@xxx

git pull orgin xxx
注意这里pull是可以拉取
但是push的话就会返回错误

错误信息如下:
error: src refspec xxx does not match any.
error: failed to push some refs to 'git@'

在stackOverflow 搜了一下 有解决方案
git push origin HEAD:branch

但是我是想问有没有方法恢复成如下的方式?
git push origin xxx

而且这里push的在git.log日志文件中 显示的是root


你的远程仓库都没得对应的分支,你咋推送?

git push -u origin master
Username for 'https://github.com': yourusername
Password for 'https://yourusername@github.com': 
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/yourusername/foobar.git'
//解决方案:

git init
git add .
git commit -m 'message'
git *create remote
git push -u origin master

谢谢邀请。可以执行git pull origin 分支,执行git push origin 分支就出错!好神奇啊!你在你本地执行ssh –T git@github.com试试看出现什么

【热门文章】
【热门文章】