2015-01-09 206 views
7

我想通過Git Bash刪除遠程git存儲庫。我知道我可以通過GitHub刪除它;不過,我想通過命令行學習如何做到這一點。我不只是想刪除它中的文件,或者替換它,我想徹底刪除它。我花了兩天時間瀏覽論壇,文章,博客和教程,沒有任何工作。如何從命令行(Git Bash)刪除遠程Git存儲庫?

一些初步信息:

$ git remote -v 
thisbranch https://github.com/thisuser/test-repo.git (fetch) 
thisbranch https://github.com/thisuser/test-repo.git (push) 

$ git status 
On branch master 
nothing to commit, working directory clean 

$ git log 
Author: *info* 
Date: *info* 
    adding a new file 
Author: *info* 
Date: *info* 
    Initial commit 

$ git remote -v show thisbranch 
* remote thisbranch 
    Fetch URL: https://github.com/thisuser/test-repo.git 
    Push URL: https://github.com/thisuser/test-repo.git 
    HEAD branch: master 
    Remote branch: 
    master tracked 
    Local ref configured for 'git push': 
    master pushes to master (up to date) 

有些事情我想:

$ git remote remove https://github.com/thisuser/test-repo.git 
error: Could not remove config section 'remote.https://github.com/thisuser/test-repo.git' 

$ git remote remove master 
error: Could not remove config section 'remote.master' 

$ git remote remove thisbranch 
*returns nothing* 

$ git remote -v 
*returns nothing* 

我已經意識到我還從來沒有得到返回的名稱 '出身'。

+1

這是無法完成的。 – BrokenBinary 2015-01-09 20:27:25

回答

5

正如his comment指出的BrokenBinary,

這不能做。

無法使用Git命令刪除遠程回購(託管在GitHub或其他地方),無論是在Git Bash或其他地方,使用期間。您可以delete remote branches(假設您有寫入權限),是的,但不是整個遠程存儲庫。

但是,GitHub Developer API允許您從shell中刪除託管在GitHub上的回購站。你上面提到的

+1

謝謝@BrokenBrine和Jubobs。我想我會直接從GitHub站點刪除回購站。 – dahiana 2015-01-09 22:19:20

1

由於Jubobs可以使用github上開發的API,所以: curl -u :username -X "DELETE" https://api.github.com/repos/:username/:repo 其中:用戶名 =您的用戶名(GitHub的處理程序)和:回購 =你想擺脫

回購的名字