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.
Some initial info:
$ 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)
Some things I tried:
$ 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*
I've realized I also never get returned the name 'origin'.
Removing a remote repositoryUse the git remote rm command to remove a remote URL from your repository.
The git rm command can be used to remove individual files or a collection of files. The primary function of git rm is to remove tracked files from the Git index. Additionally, git rm can be used to remove files from both the staging index and the working directory.
As pointed out by BrokenBinary in his comment,
This can't be done.
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.
However, the GitHub Developer API allows you to delete, from your shell, a repo hosted on GitHub.
As Jubobs mentioned above you can use github dev API, so:
curl -u :username -X "DELETE" https://api.github.com/repos/:username/:repo
Where :username = your username(github handler) and :repo = a name of a repo you want to get rid of
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With