git push出错: src refspec dev/xxx does not match any

使用如下命令gitp push出错:

复制代码
git push origin 远端分支名

git push origin dev/xxxx

error: src refspec dev/xxxx does not match any

error: failed to push some refs to 'https://git.woa.com/.....'

解决方案 1:

复制代码
git push origin 本地分支名:远端分支名

解决方案2:

如果本地分支已经关联了远程分支就使用下面命令直接push即可。

复制代码
git push .

原理:

疑问:

为什么之前同样的本地分支和远程分支使用git push origin 远端分支名 就没问题?

可能是因为本地有多个head?git commit 之后没有push然后又git reset到别的commit。

相关推荐
夏至春来-美美6 小时前
git clone报错
git
番茄不是西红柿kk15 小时前
deepseek-harness跨平台桌面端二开项目(附git仓库地址+安装包)
git·agent·codex·deepseek·deepseekharness
leoZ23118 小时前
10-Git 仓库蒸馏术:从代码仓库到 OpenClaw 虚拟人-蒸馏工具链
大数据·git·深度学习·神经网络·目标检测·elasticsearch·lstm
fpcc1 天前
工具使用—git diff命令分析说明
git·工具
console.log('npc')1 天前
Git 删除指定提交记录操作指南
git
随风丶飘1 天前
[特殊字符] 告别“update“和“fix bug“——Smart Git Commit LLM 让 AI 帮你写专业的 Git 提交信息
人工智能·git·bug
yanlaifan1 天前
git clone时候指定换行符
git
小小安于乱1 天前
解决IDEA的git插件pull代码冲突但右下角不提示消息问题
java·git·intellij-idea
ITKEY_2 天前
git 命令行操作回退到指定版本
git
New_Horizons6662 天前
Git 操作(使用git-commit-template)
git