如何从命令行(Git Bash)删除远程Git存储库?

时间:2015-01-09 20:23:50

标签: git github repository

我正在尝试通过Git Bash删除远程git存储库。我知道我可以通过GitHub删除它;但是,我想通过命令行学习如何这样做。我不只是想删除它中的文件,或者替换它,我想完全删除它。我花了最近两天的时间浏览论坛,文章,博客和教程,但没有任何工作。

一些初步信息:

$ 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*

我意识到我也永远不会归还“起源”这个名字。

3 个答案:

答案 0 :(得分:8)

正如his comment中的BrokenBinary指出的那样,

  

这无法完成。

您不能使用Git命令删除远程仓库(托管在GitHub或其他地方),无论是在Git Bash还是其他地方,期间。您可以delete remote branches(假设您具有对它们的写入权限),是,但不是整个远程存储库。

但是,GitHub Developer API允许您从shell中删除GitHub上托管的repo。

答案 1 :(得分:5)

正如上面提到的Jubobs你可以使用github dev API,所以: curl -u :username -X "DELETE" https://api.github.com/repos/:username/:repo 其中:用户名 =您的用户名(github处理程序)和:repo =您想要摆脱的回购的名称

答案 2 :(得分:2)

要从cmd行删除远程仓库,可以使用以下命令

AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/macos/Documents/SubmissionExpert1/app/src/main/res/layout/data.xml","position":{"startLine":11}}],"original":"/Users/macos/Documents/SubmissionExpert1/app/src/main/res/layout/data.xml:12: AAPT: error: resource string/name_heroes (aka com.example.submissionexpert1:string/name_heroes) not found.\n ","tool":"AAPT"} AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/macos/Documents/SubmissionExpert1/app/src/main/res/layout/data.xml","position":{"startLine":20}}],"original":"/Users/macos/Documents/SubmissionExpert1/app/src/main/res/layout/data.xml:21: AAPT: error: resource string/lorem (aka com.example.submissionexpert1:string/lorem) not found.\n ","tool":"AAPT"}