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

浏览:40日期:2023-09-17

问题描述

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

操作顺序如下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

问题解答

回答1:

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

回答2:

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

git push -u origin masterUsername for ’https://github.com’: yourusernamePassword 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 initgit add .git commit -m ’message’git *create remotegit push -u origin master

相关文章: