mirror of
https://github.com/acedanger/docker.git
synced 2025-12-06 02:10:12 -08:00
Add scripts for importing GitHub Gists into OpenGist with different authentication methods
This commit is contained in:
22
opengist/import-github-gist.sh
Executable file
22
opengist/import-github-gist.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# This script imports all GitHub Gists into OpenGist.
|
||||
|
||||
github_user=acedanger
|
||||
opengist_user=acedanger
|
||||
opengist_password="Q\$R%23rGV0tMGeIc1%23" # URL-encoded password (# becomes %23)
|
||||
|
||||
opengist_url="http://$opengist_user:$opengist_password@localhost:6157/init"
|
||||
|
||||
curl -s https://api.github.com/users/"$github_user"/gists?per_page=100 | jq '.[] | .git_pull_url' -r | while read url; do
|
||||
git clone "$url"
|
||||
repo_dir=$(basename "$url" .git)
|
||||
|
||||
# Add remote, push, and remove the directory
|
||||
if [ -d "$repo_dir" ]; then
|
||||
cd "$repo_dir"
|
||||
git remote add gist "$opengist_url"
|
||||
git push -u gist --all
|
||||
cd ..
|
||||
rm -rf "$repo_dir"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user