From 3d4da5ac6000a4871c5caa80d1e61f2782da3069 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sat, 2 Dec 2023 23:27:35 -0600 Subject: feat: finish converting md to org --- blog/2021-07-15-delete-gitlab-repos.org | 103 +++++++++++++++++--------------- 1 file changed, 54 insertions(+), 49 deletions(-) (limited to 'blog/2021-07-15-delete-gitlab-repos.org') diff --git a/blog/2021-07-15-delete-gitlab-repos.org b/blog/2021-07-15-delete-gitlab-repos.org index 5d126f4..99249e9 100644 --- a/blog/2021-07-15-delete-gitlab-repos.org +++ b/blog/2021-07-15-delete-gitlab-repos.org @@ -1,53 +1,57 @@ -+++ -date = 2021-07-15 -title = "How to Delete All GitLab Repositories" -description = "Learn how to delete all GitLab repositories in your user account." -draft = false -+++ - -## Background - -Have you ever used GitLab to host your source code, moved to a different host, -and wanted to delete everything from your GitLab account? -Well, this post covers any scenario where you would want to delete all +#+title: How to Delete All GitLab Repositories +#+date: 2021-07-15 + +** Background +:PROPERTIES: +:CUSTOM_ID: background +:END: +Have you ever used GitLab to host your source code, moved to a different +host, and wanted to delete everything from your GitLab account? Well, +this post covers any scenario where you would want to delete all repositories from your GitLab account. -For me, I currently maintain around 30 repositories and don't like to manually -delete them whenever I switch host. -GitHub has a few different tools online to delete all repositories for you, -but I have not found anything similar for GitLab, so I needed an alternative -solution. - -## Use a Python Script - -### Requirements - -Before we look at the script, make sure you know your GitLab username. Next, -[create an authorization token](https://gitlab.com/-/profile/personal_access_tokens) -so that the Python script can delete your repositories. Don't lose this token or -else you'll need to create a new one. - -### Create the Script - -To run a Python script, you must first create it. Open a terminal and enter the -following commands in whichever directory you prefer to store the script. You -can do the same things in a file manager if you prefer. - -```sh +For me, I currently maintain around 30 repositories and don't like to +manually delete them whenever I switch host. GitHub has a few different +tools online to delete all repositories for you, but I have not found +anything similar for GitLab, so I needed an alternative solution. + +** Use a Python Script +:PROPERTIES: +:CUSTOM_ID: use-a-python-script +:END: +*** Requirements +:PROPERTIES: +:CUSTOM_ID: requirements +:END: +Before we look at the script, make sure you know your GitLab username. +Next, [[https://gitlab.com/-/profile/personal_access_tokens][create an +authorization token]] so that the Python script can delete your +repositories. Don't lose this token or else you'll need to create a new +one. + +*** Create the Script +:PROPERTIES: +:CUSTOM_ID: create-the-script +:END: +To run a Python script, you must first create it. Open a terminal and +enter the following commands in whichever directory you prefer to store +the script. You can do the same things in a file manager if you prefer. + +#+begin_src sh mkdir delete-gitlab -``` +#+end_src -```sh +#+begin_src sh cd delete-gitlab -``` +#+end_src -```sh +#+begin_src sh nano main.py -``` +#+end_src -Enter the following code into your `main.py` script. +Enter the following code into your =main.py= script. -```python +#+begin_src python import request import json @@ -101,15 +105,16 @@ def main(): if __name__ == "__main__": main() -``` +#+end_src -Now that you have the proper information, replace `{user-id}` with your GitLab -username and `{auth-token}` with the authorization token you created earlier. +Now that you have the proper information, replace ={user-id}= with your +GitLab username and ={auth-token}= with the authorization token you +created earlier. -Finally, simply run the script and watch the output. You can also use PyCharm -Community Edition to edit and run the Python script if you don't want to work -in a terminal. +Finally, simply run the script and watch the output. You can also use +PyCharm Community Edition to edit and run the Python script if you don't +want to work in a terminal. -```sh +#+begin_src sh python3 main.py -``` +#+end_src -- cgit v1.2.3-70-g09d2