I'm quite sure this question has been asked before but I dont seem to find it. So sorry if it is a dublicate.
I have a bare repository lets call it project_x.git, if we check the config file it says
[core]
repositoryformatversion = 0
filemode = false
bare = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
so it bare for sure right, bare=true. Now I'm trying to replace master with a cleanup version.
$ git push origin :master
remote: Updating references: 100% (1/1)
To http://gitrepo.local/git/project_x.git
! [remote rejected] master (branch is currently checked out)
error: failed to push some refs to 'http://gitrepo.local/git/project_x.git'
I'm using gitblit btw, and that is not the actual server url.
This response puzzels me, how can I have a checkout branch on my bare repo? Who is working on that branch :), Makes no sense. Either it is not bare some how config wise or gitblit is messing with me. I dont understand?
What is wrong?
btw same message if I try
git push -f ,
Edit: this works but you can not delete the branch as I tried earlier.
Thanks
There is a HEAD set on the bare repo, which actually points to the branch which is checked out when you run git clone <url>
without arguments.
As far as I know you can't delete the remote HEAD branch, so if you want to delete the master you have to push a second branch, move your HEAD to that branch, then push an empty branch in master:
locally:
git branch mybranch
git push origin mybranch
on the bare-repo:
git symbolic-ref HEAD refs/heads/mybranch
locally:
git push origin :master
Of course you can then push another branch you call master
if you want, and move the HEAD back to it.
git push origin newbranch:master
git symbolic-ref HEAD refs/heads/master #(on bare repo)