Search code examples
gitgithubpushsynchronizationgithub-for-mac

GitHub For Mac doesn't want to delete a branch, but on the console I can?


I have been struggling using Github for mac and it basically screwed up my whole app. I was able to revert back to a certain point now, merge everything into the master etc.

What I did next was delete all the old branches, but one branch it does not allow.

On the console I was easily able to delete it, but not on the Github for mac app not. I'm thinking of deleting the github for mac app now in any case.

Also for some reason my changes, commits and updates are not pushing to Github either via the console and Github for mac app.

The error for the posts branch:

 2013-05-08 10:44:50.317 GitHub for Mac Login[1274:707] AskPass with arguments: (
"/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
"Username for 'https://github.com': ")
2013-05-08 10:44:50.373 GitHub for Mac Login[1275:707] AskPass with arguments: (
"/Applications/GitHub.app/Contents/MacOS/GitHub for Mac Login",
"Password for 'https://[email protected]': ")
remote: error: refusing to delete the current branch: refs/heads/posts        
To https://github.com/ewalkerblog/alift.git
! [remote rejected] posts (deletion of the current branch prohibited)
error: failed to push some refs to 'https://github.com/ewalkerblog/alift.git'
(1)

Any help please? Is the Github for mac still to buggy?


Solution

  • The error message in the log is very explicit (though not perfectly clear for someone who sees it the first time):

    ! [remote rejected] posts (deletion of the current branch prohibited)
    

    Since the remote (a Github repo) is a bare repo, it has no "current" branch per se, since it has no working copy. By "current branch" Git means the default branch of your Github repo, which you cannot delete.

    To fix this, change the repo's default branch in the repo settings (the "Settings" tab is on the top right of the repo page). After that, you can remove it like all other branches.