AI摘要
Grace AI
今天想上传内容到GitHub的时候发现以前fork了很多的仓库,大多都已经没有学习的意义了,又或者是和谐了,一个一个删除太过于麻烦,于是在网上搜集了一些方法,在这里记录一下
- 申请token
- 制作删除仓库的列表文件
- 启动powershell
访问 https://github.com/settings/tokens 获取delete_repo的token
新建一个txt文件,记录你需要删除的仓库
启动powershell
输入如下指令
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
get-content E:\github_del.txt | ForEach-Object { Invoke-WebRequest -Uri https://api.github.com/repos/$_ -Method “DELETE” -Headers @{"Authorization"="token xxx"} }
# 例如下面,这里需要替换的是repo.txt的地址以及token后面的xxx,双引号要保留
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
get-content D:\research\delete-repository-in-bulk\repo.txt | ForEach-Object { Invoke-WebRequest -Uri https://api.github.com/repos/$_ -Method “DELETE” -Headers @{"Authorization"="token ghp_aoJDtXrLVoKteR3kkBNVyJt4txS"} }
其中需要注意repo的地址以及token,这些都是需要进行替换的
运行成功!
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容