Skip to content

Instantly share code, notes, and snippets.

@victorgs
Last active July 1, 2020 12:14
Show Gist options
  • Save victorgs/ccc9911c51b3bca3ff07eddbb3f1ef52 to your computer and use it in GitHub Desktop.
Save victorgs/ccc9911c51b3bca3ff07eddbb3f1ef52 to your computer and use it in GitHub Desktop.
Unfollow everyone who you currently follow on GitHub
# it does not manage pagination
# just run it until you do not see more unfollowing messages
# token needs user:follow permissions
TOKEN=$1
USER_LIST=$(curl -sS -H "Authorization: token $TOKEN" https://api.github.com/user/following | grep login | awk NF | awk -F'"' '{print $4}')
for user in $USER_LIST; do
echo "unfollowing $user\n"
curl -sS -X DELETE -H "Authorization: token $TOKEN" https://api.github.com/user/following/$user
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment