2017-08-15 155 views
0

我克隆一個全球性項目混帳:似乎無法刪除遠程

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

我添加的遠程分支

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

現在的問題是我沒有http://[email protected]/janedoe/my.git項目了在gitlab上。

所以,當我試圖刪除遠程分支

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

如何消除這種遙控器。謝謝!

+0

可能重複的[如何從git repo中刪除遠程來源](https://stackoverflow.com/questions/16330404/how-to-remove-remote-origin-from-git-repo) – 1615903

回答

1

您與git remoteadd添加遠程回購所以你可以rm刪除它。嘗試git remote --help獲取完整列表。

git remote rm gitlab應該爲你想做的事情工作。

+0

嗨Bily,That似乎工作!我似乎無法理解使用git remote rm和git push --delete之間的區別。任何幫助瞭解 – Romeo

+0

因此,前'git remote rm'只是刪除了對遠程回購的引用。你的「 - 刪除」從物理上將這個分支從地球表面刪除了。一個是刪除鏈接。第二個是phycally刪除該回購/分支的存在 –

+0

rm就像刪除unix目錄中的符號鏈接。你的'--delete'就像是cd到那個符號鏈接並刪除目錄及其所有內容。 –

0

不能刪除當前的遠程「HEAD」分支..