如何从命令行(Git Bash)删除远程Git存储库? [英] How can I delete a remote Git repository from the command line (Git Bash)?

查看:57
本文介绍了如何从命令行(Git Bash)删除远程Git存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Git Bash删除远程git存储库.我知道我可以通过GitHub删除它;但是,我想通过命令行学习如何做到这一点.我不仅要删除其中的文件或替换它,还想完全删除它.最近两天,我在论坛,文章,博客和教程中进行了筛选,但没有任何效果.

I'm trying to remove a remote git repository through Git Bash. I'm aware that I can just delete it through GitHub; however, I want to learn how to do so through the command line. I don't just want to remove the files in it, or replace it, I want to completely delete it. I spent the last two days sifting through forums, articles, blogs and tutorials, and nothing has worked.

一些初始信息:

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

我意识到我也永远都不会返回名字'origin'.

I've realized I also never get returned the name 'origin'.

推荐答案

BrokenBinary在

As pointed out by BrokenBinary in his comment,

无法完成.

您不能使用Git命令删除远程仓库(托管在GitHub或其他地方),无论是在Git Bash还是其他地方.您可以删除远程分支(假设您具有对它们),是的,但不是整个远程存储库.

You cannot delete a remote repo (hosted on GitHub or elsewhere) with Git commands, be it in Git Bash or elsewhere, period. You can delete remote branches (assuming you have write access to them), yes, but not an entire remote repository.

但是,通过 GitHub Developer API ,您可以删除,从您的外壳中,一个托管在GitHub上的存储库中.

However, the GitHub Developer API allows you to delete, from your shell, a repo hosted on GitHub.

这篇关于如何从命令行(Git Bash)删除远程Git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆