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:
32
opengist/import-github-gist-alternative.sh
Executable file
32
opengist/import-github-gist-alternative.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Alternative script for importing GitHub Gists into OpenGist
|
||||
# This version handles authentication differently to avoid URL parsing issues
|
||||
|
||||
github_user=acedanger
|
||||
opengist_user=acedanger
|
||||
opengist_password="Q\$R#rGV0tMGeIc1#"
|
||||
opengist_host="gist.ptrwd.com"
|
||||
|
||||
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"
|
||||
|
||||
# Set up Git credentials for this repository
|
||||
git config credential.helper store
|
||||
echo "https://$opengist_user:$opengist_password@$opengist_host" > .git-credentials
|
||||
git config credential.helper "store --file=.git-credentials"
|
||||
|
||||
# Add remote and push
|
||||
git remote add gist "https://$opengist_host/init"
|
||||
git push -u gist --all
|
||||
|
||||
# Clean up
|
||||
rm -f .git-credentials
|
||||
cd ..
|
||||
rm -rf "$repo_dir"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user