Use a background

1 Too many warehouses have been created, some are useless or abandoned

2 fork someone else’s project and don’t want it later

Github also requires you to manually enter the name of the repository when deleting it

steps

  1. Create a token

    1). Create tokens location: github.com -> Avatar -> Settings -> Developer Settings -> Personal Access Tokens Click to create tokens

    2). Click Generate new Token and enter the password

    3). Note: Enter a name that marks what the token does, for example: DELETE_TOKEN

    4). Slide down to finddelete_repoCheck the

    5). Generate token is created and copied.

  1. Create a new folder and create the delete_repo.sh file

Replace both DELETE_KOKEN and GithubName with your own arguments

Enter the command line to quickly create a file

touch delete_repo.sh 
Copy the code

content

# replace both DELETE_KOKEN and GithubName with their own DELETE_KOKEN="ghp_VjF1qU762551823Lt7uoMvxlGSmvfFbsO2dgbfg"
GithubName="xxxx"

for repName in $(cat repos.txt)
do
    echo "Delete "$repName
    curl -XDELETE -H "Authorization: token ${DELETE_KOKEN}" https://api.github.com/repos/${GithubName}/${repName}
done
Copy the code
  1. Create repoa. TXT at the same level and add the name of the repository to repos. TXT

Enter the command line to quickly create a file

touch repos.txt
Copy the code

Name selection technique: click on the upper left margin of the warehouse name three times to select a new line

content

   repoName1
   repoName2
   ...
Copy the code

You don’t need to wear a user name

For example repoName1

Not the username /repoName1

perform

Command line input

./delete_repo.sh
Copy the code