git:似乎无法删除远程

时间:2017-08-15 15:18:44

标签: git

我克隆了一个全球项目

git clone https://github.com/lornajane/scripts.git scripts

我添加了远程分支

git remote add gitlab  http://ankits@abc.xyz/janedoe/my.git
git push gitlab master -f

现在问题是我不再在gitlab上进行http://ankits@abc.xyz/janedoe/my.git项目了。

所以当我尝试删除远程分支

git push gitlab --delete master

我收到了错误:

remote: error: By default, deleting the current branch is denied, because the next
remote: 'git clone' won't result in any file checked out, causing confusion.
remote: 
remote: You can set 'receive.denyDeleteCurrent' configuration variable to
remote: 'warn' or 'ignore' in the remote repository to allow deleting the
remote: current branch, with or without a warning message.
remote: 
remote: To squelch this message, you can set it to 'refuse'.
remote: error: refusing to delete the current branch: refs/heads/master
To http://ankits@abc.xyz/janedoe/my.git
 ! [remote rejected] master (deletion of the current branch prohibited)

如何删除此遥控器。谢谢!

2 个答案:

答案 0 :(得分:1)

您使用git remote添加了add的远程仓库,因此您可以使用rm将其删除。请尝试git remote --help获取完整列表。

git remote rm gitlab应该适用于你想做的事情。

答案 1 :(得分:0)

您无法删除当前的遥控器" HEAD"分支..