无法删除git远程分支的问题
2016-10-09 15:03
239 查看
当删除远程分支时,可能会出错以下的错误:
$ git push origin :alpha
remote: error: By default, deleting the current branch is denied, because the next
remote: error: 'git clone' won't result in any file checked out, causing confusion.
remote: error:
remote: error: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: error: current branch, with or without a warning message.
remote: error:
remote: error: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/alpha
To remote_repository_uri.git
! [remote rejected] alpha (deletion of the current branch prohibited)
error: failed to push some refs to 'remote_repository_uri.git'
原因好像是因为HEAD指向了要删除的分支。
解决方法有两个:
1,修改HEAD的指向
http://www.drkdidel.be/en/blog/84/git-refusing-to-delete-a-remote-branch-because-it-is-set-as-current
2,修改git的配置
(没具体试过,但上面的错误信息来说,如果删除的话,可能导致git clone命令无法check out出文件,
所以感觉还是方法1好一些)
http://blog.csdn.net/sunalongl/article/details/52013435
$ git push origin :alpha
remote: error: By default, deleting the current branch is denied, because the next
remote: error: 'git clone' won't result in any file checked out, causing confusion.
remote: error:
remote: error: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: error: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: error: current branch, with or without a warning message.
remote: error:
remote: error: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/alpha
To remote_repository_uri.git
! [remote rejected] alpha (deletion of the current branch prohibited)
error: failed to push some refs to 'remote_repository_uri.git'
原因好像是因为HEAD指向了要删除的分支。
解决方法有两个:
1,修改HEAD的指向
http://www.drkdidel.be/en/blog/84/git-refusing-to-delete-a-remote-branch-because-it-is-set-as-current
2,修改git的配置
(没具体试过,但上面的错误信息来说,如果删除的话,可能导致git clone命令无法check out出文件,
所以感觉还是方法1好一些)
http://blog.csdn.net/sunalongl/article/details/52013435
相关文章推荐
- git删除远程分支后,本地同步问题
- Git删除远程master分支问题
- github 创建远程分支以及远程分支无法删除的问题解决
- github 创建远程分支以及远程分支无法删除的问题解决
- git创建和删除远程分支
- git删除远程分支
- git删除远程分之后,本地同步问题
- git 删除远程主分支及其它操作
- Git查看、删除、重命名远程分支和tag
- git 删除远程分支
- git 删除远程分支
- git技巧:删除在本地有但在远程库中已经不存在的分支
- Git查看、删除远程分支和tag(转自:http://zengrong.net/post/1746.htm)
- Git新建本地分支与远程分支关联问题:git branch --set-upstream
- GIT查看、删除、重命名远程分支和TAG
- Git删除远程Tag、分支
- Git查看、删除远程分支和tag
- Git查看、删除远程分支和tag
- git删除远程分支
- Git查看、删除远程分支和tag