上传文件至 'md'
This commit is contained in:
parent
0d9d7d8e7a
commit
3a7cc21f16
46
md/GitHub利用shell脚本批量删除仓库.md
Normal file
46
md/GitHub利用shell脚本批量删除仓库.md
Normal file
@ -0,0 +1,46 @@
|
||||
<h1><center>GitHub利用shell脚本批量删除仓库</center></h1>
|
||||
|
||||
作者:行癫(盗版必究)
|
||||
|
||||
------
|
||||
|
||||
## 一:环境准备
|
||||
|
||||
1.Github账户(有需要批量删除的仓库)
|
||||
|
||||
2.一台可以访问Github的Linux服务器
|
||||
|
||||
## 二:批量删除
|
||||
|
||||
#### 1.获取Github的token
|
||||
|
||||
在 GitHub 的个人设置中,找到 Developer settings -> Personal access tokens,然后点击 Generate new token;确保勾选上 delete_repo 权限,并生成 Token。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
#### 2.批量删除脚本
|
||||
|
||||
```shell
|
||||
[root@xingdiancloud ~]# cat github_delete.sh
|
||||
#!/bin/bash
|
||||
|
||||
TOKEN="YOUR_PERSONAL_ACCESS_TOKEN"
|
||||
|
||||
repos=("repo1" "repo2" "repo3") # 要删除的仓库列表
|
||||
|
||||
for repo in "${repos[@]}"
|
||||
do
|
||||
curl -X DELETE -H "Authorization: token $TOKEN" "https://api.github.com/repos/YOUR_USERNAME/$repo"
|
||||
done
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user