当删除远程git分支“错误:无法推送到不合格的目的地” [英] When deleting remote git branch "error: unable to push to unqualified destination"

查看:1384
本文介绍了当删除远程git分支“错误:无法推送到不合格的目的地”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用

  git push origin:my_remote_branch 

得到:

 错误:无法推送到不合格的目的地:my_remote_branch 
目的地refspec既不匹配远程的现有ref,
也以refs /开头,我们无法根据源参考猜测前缀。
错误:无法将某些参考文献推送到'git@example.com:/ myrepo'

这些是我目前的分支机构

  git branch -a 
* develop
master
remotes / origin / HEAD - >原产地/主产地
遥控器/原产地/开发地
遥控器/原产地/ my_remote_branch

git分支-r --merged
原产地/ HEAD - >原产地/主产地
产地/开发地区
产地/主地区

我可以摆脱这个分支将不胜感激。

解决方案

refs / remotes / origin / my_remote_branch 存在于您的本地存储库中并不意味着 origin refs / heads / my_remote_branch c>远程仓库。



执行 git fetch -p origin 使 refs / remotes / origin / my_remote_branch 如果它已经在原点中被删除,则离开。 -p 选项指示提取删除相应遥控器中不存在的任何跟踪分支;默认情况下它们保持在周围。


I'm trying to delete a remote git branch with

git push origin :my_remote_branch

and getting:

error: unable to push to unqualified destination: my_remote_branch
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@example.com:/myrepo'

these are my current branches

git branch -a
* develop
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/develop
  remotes/origin/my_remote_branch

git branch -r --merged
  origin/HEAD -> origin/master
  origin/develop
  origin/master

Any ideas on how I can get rid of this branch would be appreciated.

解决方案

The fact that refs/remotes/origin/my_remote_branch exists in your local repository does not imply refs/heads/my_remote_branch exists in the origin remote repository.

Do git fetch -p origin to make refs/remotes/origin/my_remote_branch go away if it's already deleted in origin. The -p option tells fetch to delete any tracking branches that no longer exist in the corresponding remotes; by default they are kept around.

这篇关于当删除远程git分支“错误:无法推送到不合格的目的地”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆