Romeo
Romeo

Reputation: 147

git: can't seem to delete remote

I cloned a global project

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

And I added remote branch

git remote add gitlab  http://[email protected]/janedoe/my.git
git push gitlab master -f

Now the problem is I don't have http://[email protected]/janedoe/my.git project anymore on gitlab.

So when I tried deleting remote branch

git push gitlab --delete master

I got error:

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://[email protected]/janedoe/my.git
 ! [remote rejected] master (deletion of the current branch prohibited)

How do remove this remote. Thanks!

Upvotes: 0

Views: 686

Answers (2)

Billy Ferguson
Billy Ferguson

Reputation: 1439

You added the remote repo with git remote with add so you can remove it with rm. Try git remote --help for a full listing.

git remote rm gitlab should work for what you wanna do.

Upvotes: 1

Matias Elorriaga
Matias Elorriaga

Reputation: 9150

You cannot delete the current remote "HEAD" branch..

Upvotes: 0

Related Questions