Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过API删除github respository_Github - Fatal编程技术网

通过API删除github respository

通过API删除github respository,github,Github,我想删除使用github API的存储库列表。但我得到的回应是: {“消息”:“错误凭据”,“文档\u url”: “} 复制步骤 首先,我在这里创建了一个个人访问令牌: 我确保它具有范围delete\u repo 然后,为我的令牌创建一个变量 export GITHUB\u TOKEN=asasasfsfs 最后运行此脚本: #!/bin/bash repos=( "my_username/test-1" ) for i in "${repos[@]}" do : c

我想删除使用github API的存储库列表。但我得到的回应是:

{“消息”:“错误凭据”,“文档\u url”: “}

复制步骤 首先,我在这里创建了一个个人访问令牌:

我确保它具有范围
delete\u repo

然后,为我的令牌创建一个变量
export GITHUB\u TOKEN=asasasfsfs

最后运行此脚本:

#!/bin/bash

repos=(
    "my_username/test-1"
)

for i in "${repos[@]}"
do
   :
   curl -XDELETE -H 'Authorization: token $GITHUB_TOKEN' "https://api.github.com/repos/$i ";
done
将标题更改为“Authorization:$GITHUB\u TOKEN”

{“消息”:“必须具有存储库的管理员权限。”,
“文档url”: “}

搜索错误并读取提供的链接对我没有帮助。我怎么能对自己的存储库(它不在组织中)没有管理员权限?我还尝试检查了personal access token generation(个人访问令牌生成)页面中的所有内容,但没有效果。

使用命令(插入用户、令牌和repo)

使用命令(插入用户、令牌和repo)


您必须通过此页面生成包含删除回购范围的令牌:

您必须通过此页面生成包含删除回购范围的令牌:

curl -u $user:$token -XDELETE "https://api.github.com/repos/$user/$repo"