Skip to content

Instantly share code, notes, and snippets.

@bonelifer
Forked from vbyndych/gist-all-clone
Created September 3, 2020 20:09
Show Gist options
  • Select an option

  • Save bonelifer/d2fff2da9503ee4f1f62efc1f14c46c0 to your computer and use it in GitHub Desktop.

Select an option

Save bonelifer/d2fff2da9503ee4f1f62efc1f14c46c0 to your computer and use it in GitHub Desktop.
gists-clone-push
#!/bin/sh
GITHUB_TOKEN=${1}
LIST_URL=https://${GITHUB_TOKEN}:@api.github.com/users/vbyndych/gists
SINGLE_URL=https://${GITHUB_TOKEN}:@api.github.com/gists
curl -qs $LIST_URL | grep '"id": "' | sed 's/"id": "\([a-z0-9]*\)",/\1/g'|
while read GIST_ID
do
DESCRIPTION=$(curl -qs "$SINGLE_URL/$GIST_ID" | grep '"description": "' | sed 's/"description": "\(.*\)",/\1/g' | tr -d '[:space:]')
echo "${PWD}/$DESCRIPTION"
if [ -d "${PWD}/$DESCRIPTION" ]
then
git -C ./${DESCRIPTION} pull
else
git clone git@gist.github.com:${GIST_ID}.git ${DESCRIPTION}
fi
done
#!/bin/bash
for i in *; do
if [ -d "$i" ]; then
echo "$i"
cd "$i"
git commit -am '' --allow-empty-message
git push
cd ..
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment