创建一个文件,例如命名为repos.txt,编写需要删除的库:
aaa\repos1
aaa\repos2
aaa 表示自己的用户名,repos1表示repository的名称
访问https://github.com/settings/tokens ,获取具有删除库权限的 delete-repo token
终端执行下面命令进行删除:
Linux:
$ while read r;do curl -XDELETE -H 'Authorization: token xxx' "https://api.github.com/repos/$r ";done < repos.txt
Windows Power Shell:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
get-content repos.txt | ForEach-Object { Invoke-WebRequest -Uri https://api.github.com/repos/$_ -Method “DELETE” -Headers @{"Authorization"="token xxx"} }