6

Possible Duplicate:
How do I delete a Git branch both locally and in Github?

First of all, I read how to remove a branch, but for some reason is not working on my project: https://github.com/ralcr/sdk.ralcr

When you first enter here you see some files 10 months old in a gh-pages branch. I have no idea how this branch was created and why it's displayed first, but I want to remove it and this is not working

Balutas-MacBook-Pro:sdk.ralcr Cristi$ git push origin --delete gh-pages
fatal: 'origin' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I want only the master branch.

2
  • can you do git remote ? maybe your remote is not origin ... Commented Oct 8, 2012 at 19:16
  • Seems is not, but which one is my repo? I posted the results below. Commented Oct 8, 2012 at 19:36

3 Answers 3

4

I found the solution here: https://github.com/matthew-brett/pydagogue/blob/master/gh_delete_master.rst I couldn't delete the branch because was the default branch. To change it go to Admin and there's a drop down for that.

Sign up to request clarification or add additional context in comments.

Comments

3

To delete a remote branch, you must do it like so:

git push <remote> :<branch>
# example
git push origin :gh-pages

But in your case, origin don't seem to be a remote repo. You should checkout your remote name and use the good one.

git remote

Also, make sure your remote URL is writable one. Using the git protocol is read only, and so you'll need to pickup the ssh one. (should also work with the https url)

6 Comments

ls-remote gives me this. Balutas-MacBook-Pro:sdk.ralcr Cristi$ git ls-remote From [email protected]:ralcr/sdk.ralcr.git 75e1db961aa1d2377e6f7c35542d7ee3a53712a0 HEAD 75e1db961aa1d2377e6f7c35542d7ee3a53712a0 refs/heads/gh-pages 8edf43d1bb60646c5c2f2026bae8c229763d5f98 refs/heads/master
Oh sorry, it's just git remote. ls-remote is to list remote branches, tags, and other refs. (edited)
Ok, git remote gives me something else: ralcr
But still not working: Balutas-MacBook-Pro:sdk.ralcr Cristi$ git push ralcr :gh-pages remote: error: refusing to delete the current branch: refs/heads/gh-pages To [email protected]:ralcr/sdk.ralcr.git ! [remote rejected] gh-pages (deletion of the current branch prohibited) error: failed to push some refs to '[email protected]:ralcr/sdk.ralcr.git'
Oh, you should check out you use a writable url/protocol on your remote if .git/config (git:// protocol is read only). If this is good, then you should checkout you really have write access to your repo. Is it your own?
|
2

Try using git branch -d <feature-branch>, it should let you delete a feature branch.

(though normally git merge <branch-name> is called before that to merge the branch before deleting it)

To delete the branch on remote:

git push origin :<feature-branch>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.