I'm currently running a bash script to automatically create a remote repository on Github using curl. I was wondering if there was any way of also deleting remote Github repositories on the command line as well. Any help would be appreciated!
Attention: The most common mistake while removing remote Git repository is typing the git remove remote command in your shell instead of using correct commands such as git remote rm and git remote remove. A rule of thumb to remember a correct command syntax: you’re asking git to manage remote repository, and you’re willing to remove it.
Note: the git remote remove command is just an alternative syntax (alias) for the git remote rm command. The git remote rm command allows you to delete a remote repository reference from the .git/config file located in your project folder.
There are several ways to clone repositories available on GitHub.com. When you view a repository while signed in to your account, the URLs you can use to clone the project onto your computer are available below the repository details. For information on setting or changing your remote URL, see " Managing remote repositories ."
That URL could be your repository on GitHub, or another user's fork, or even on a completely different server. You can only push to two types of URL addresses: Git associates a remote URL with a name, and your default remote is usually called origin. You can use the git remote add command to match a remote URL with a name.
You could use the GitHub API "Delete repository" for that.
But you will need to use a oauth token with the appropriate scope (as mentioned here)
You can see an example in this question:
curl -X DELETE -H 'Authorization: token xxx' https://api.github.com/repos/USERNAME/REPO-NAME
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