-2

I'm trying to delete a remote branch via:

git push origin :dev

But the following error appears:

remote: Updating references: 100% (1/1)
To ssh://user@git.example.com:29400/user/project.git
 ! [remote rejected] dev (branch is currently checked out)
error: failed to push some refs to 'ssh://user@git.example.com:29419/user/project.git'


Here's some more detail about the origin:

git remote show origin
* remote origin
  Fetch URL: ssh://user@git.example.com:29400/user/project.git
  Push  URL: ssh://user@git.example.com:29400/user/project.git
  HEAD branch: dev
  Remote branches:
    dev    tracked
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local refs configured for 'git push':
    dev    pushes to dev    (up to date)
    master pushes to master (up to date)

How can I delete this remote dev branch (without direct access to the remote server)?

pbaldauf
  • 1,671
  • 2
  • 23
  • 32

2 Answers2

0

Begin deleting your local branch dev. After that you will be able to delete the remote one.

git branch -d dev
git push origin :dev
Flows
  • 3,675
  • 3
  • 28
  • 52
  • Also begin deleting the remote tracking branch with the command `git branch -d -r origin/dev` – Flows May 30 '16 at 09:41
0
git push <remote-name> --delete <branch-name>
Vale
  • 1,104
  • 1
  • 10
  • 29
  • Still the same issue – pbaldauf May 30 '16 at 09:34
  • `git config --bool core.bare true` Looks like it. Plus, check out this page that gives you the answer [step by step](http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked). – Vale May 30 '16 at 09:38