2015-01-09 316 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的处理程序)和:回购 =你想摆脱

回购的名字