mirror of
https://github.com/acedanger/docker.git
synced 2025-12-06 01:10:11 -08:00
Add scripts for importing GitHub Gists into OpenGist with different authentication methods
This commit is contained in:
37
opengist/import-github-gist-oauth.sh
Executable file
37
opengist/import-github-gist-oauth.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# GitHub Gist import script using GitHub token for authentication
|
||||
# This script works by first logging in via GitHub OAuth and then importing
|
||||
|
||||
github_user=acedanger
|
||||
opengist_url="https://gist.ptrwd.com"
|
||||
|
||||
echo "This script requires you to first log in to OpenGist via GitHub OAuth."
|
||||
echo "Please visit: $opengist_url"
|
||||
echo "Log in with your GitHub account, then return here and press Enter to continue..."
|
||||
read -p "Press Enter when you've logged in via GitHub OAuth: "
|
||||
|
||||
echo "Starting GitHub Gist import..."
|
||||
|
||||
curl -s https://api.github.com/users/"$github_user"/gists?per_page=100 | jq '.[] | .git_pull_url' -r | while read url; do
|
||||
echo "Processing gist: $url"
|
||||
git clone "$url"
|
||||
repo_dir=$(basename "$url" .git)
|
||||
|
||||
if [ -d "$repo_dir" ]; then
|
||||
cd "$repo_dir"
|
||||
|
||||
# Use the web-based authentication by prompting the user
|
||||
echo "For repository $repo_dir, you'll need to authenticate via browser..."
|
||||
echo "When prompted, use your GitHub credentials that you used to log in to OpenGist"
|
||||
|
||||
# Add remote and push
|
||||
git remote add gist "$opengist_url/init"
|
||||
git push -u gist --all
|
||||
|
||||
cd ..
|
||||
rm -rf "$repo_dir"
|
||||
echo "Completed import of $repo_dir"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Import process completed!"
|
||||
Reference in New Issue
Block a user