The problem of deleting the remote branch
来源:互联网 发布:暴风影音mac版能在线么 编辑:程序博客网 时间:2024/04/30 06:15
➜ screenwords git:(master)git push origin :master
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/master
To root@182.92.243.187:/home/gitrepos/Website.git
! [remote rejected] master (deletion of the current branch prohibited)
error: failed to push some refs to 'root@182.92.243.187:/home/gitrepos/Website.git'
---------------------------------------------------------------------------------------------------
First decide which branch should be the default branch when the repository is cloned. I assume new_master
for this example.
On one of the clients create the new_master
branch on the remote repository, you may use anything for master
instead, e.g. a commit or another branch name, or skip this step if you already have a suitable branch on the remote.
git push origin master:new_master
The next step can't be done from remote, so execute the command in your remote repository (e.g. using SSH):
给远程分支指定HEAD的操作只能在远程通过SSH完成。。
cd /path/to/my_git_repogit symbolic-ref HEAD refs/heads/new_master
Alternatively, change the content of the HEAD
file directly.
Back on the client:
git fetchgit remote show origin
You should see that the HEAD
points to new_master
instead of master
(or that HEAD
is ambiguous if you set new_master
to be master
). Now we can remove the old master:
git push origin :master
Git shouldn't complain anymore about the deletion. Finally, set the local refs/remotes/origin/HEAD
:
git remote set-head origin -a 这步是根据remote origin的head来设置本地的引用
- The problem of deleting the remote branch
- git branch -r view the newly created remote branch
- 【git】updates were rejected because the tip of your current branch is behind its remote counterpart
- updates were rejected because the tip of your current branch is behind its remote counterpart
- Updates were rejected because the tip of your current branch is behind its remote counterpart.
- Updates were rejected because the tip of your current branch is behindhint: its remote counterpart.
- 【问题处理】GIT删除主分支报错:[remote rejected] master (deletion of the current branch prohibited)
- git之you can't overwrite the remote branch问题解决
- Git- [!remote rejected]:refusing to delete the current branch
- How to delete the remote branch in git
- The problem of UDP
- The problem of Titanium
- The problem of UDP
- Root of the Problem
- Avoiding the Cost of Branch Misprediction
- The Recode of the sat-problem
- 1394. Root of the Problem
- The problem of Memory Leak
- [LeetCode] Contains Duplicate III
- 十五分钟介绍 Redis数据结构
- 杭电2023
- Linux|CentOS 7 64 挂载硬盘呦!
- ashx 使用Session
- The problem of deleting the remote branch
- Spring4配置AOP
- Decode Ways
- Leetcode题解(8):L179/Largest Number
- C++ 学习笔记一易忽略的地方
- poj 3280 Cheapest Palindrome(区间dp)
- linux命令行下操作mysql的命令汇总
- Qt:拖拽图片到QLabel上并显示
- CentOS 6.4 64位下安装BCM4313无线网卡驱动(血泪修改版)