0

I am trying to delete my remote branches. I have three of this kind

remotes/origin/test

But none of them can be deleted. I've searched for common solutions and I have found this suggestions:

git push origin :test

and

git push origin test --delete

By trying these out, I get this error:

$ git push origin test --delete

>> Receiving push

ERROR: error: Trying to write ref refs/heads/test with nonexistant object 0000000000000000000000000000000000000000

fatal: Cannot update the ref 'refs/heads/test'.

To ssh:Repository

! [remote rejected] test (pre-receive hook declined)

error: failed to push some refs to 'Repository'

I hope someone knows how to solve this problem. Thank you! :)

BryanH
  • 5,826
  • 3
  • 34
  • 47
Kevin Katzke
  • 3,581
  • 3
  • 38
  • 47
  • is there a pre-receive hook in play on the remote side? (the output you pasted seem to indicate as much). It looks like it's trying to do something with the new commit hash (which for deletes is 000000) – Brian Phillips Aug 22 '12 at 17:19
  • i am trying to delete a branch related to a project stored by my new clod hoster, which makes use of a git alias called "cctrlapp" https://www.cloudcontrol.com/documentation/getting-started/git-version-control I've also created a git remote using: git remote add cctrl REPO_URL could there be a misunderstanding for git trying to delete this remote branch? Thank you! – Kevin Katzke Aug 22 '12 at 17:34

1 Answers1

1
git push origin :test

deletes the test branch on the origin remote. Also you need to delete the branch locally

 git branch -d test

Follow cleaning up old remote git branches

Community
  • 1
  • 1
Bijendra
  • 9,467
  • 8
  • 39
  • 66
  • `--delete` flag is equivalent to the `:` syntax and Kevin states he's tried both and they fail. – Christopher Aug 22 '12 at 19:40
  • Yes, both of them failed. I've cloned my project from my cloud hosters repository. I do not have any local branches called test. I only wanted to clean my git by deleting remote branches, which i don't need any more. But every try failed. – Kevin Katzke Aug 22 '12 at 20:16
  • checkout http://stackoverflow.com/questions/3184555/cleaning-up-old-remote-git-branches @KevinKatzke – Bijendra Aug 22 '12 at 20:28
  • Thank you GhostRider :) i've posted a new answer with the solution and small question. It would be great if you could give me another litte hint :) – Kevin Katzke Aug 22 '12 at 20:46