I want to delete a list of repositories using the github API. But I get the response:
{ "message": "Bad credentials", "documentation_url": "https://developer.github.com/v3" }
Steps to reproduce
First I created a personal access token here: https://github.com/settings/tokens
I made sure it had the scope delete_repo
Then, create a variable for my token
export GITHUB_TOKEN=asasfsafaffafsafafsfs
Finally run this script:
#!/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
Changing the header to 'Authorization: $GITHUB_TOKEN'
gives
{ "message": "Must have admin rights to Repository.",
"documentation_url": "https://developer.github.com/v3/repos/#delete-a-repository" }
Searching the error and reading the provided link does not help me. How can I not have admin rights to my own repository (it's not in an org)? I have also tried checking everything in the personal access token generation page without effect.