Skip to content

Instantly share code, notes, and snippets.

@ytnobody
Last active January 10, 2026 15:50
Show Gist options
  • Select an option

  • Save ytnobody/5d0b553de30852eb05aa4da10633bfb4 to your computer and use it in GitHub Desktop.

Select an option

Save ytnobody/5d0b553de30852eb05aa4da10633bfb4 to your computer and use it in GitHub Desktop.
ytnobody用セットアップスクリプト(プライベートレポジトリを見に行くので完全に自分用)
#!/bin/bash
set -e
echo "Starting bootstrap process..."
# 1. Install GitHub CLI
if ! command -v gh &> /dev/null; then
echo "Installing GitHub CLI..."
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt-get update
sudo apt-get install gh -y
fi
# Helper function to copy to clipboard using OSC 52 (works in VS Code/Coder terminal)
osc52_copy() {
local text="$1"
local encoded=$(echo -n "$text" | base64 | tr -d '\n')
printf "\033]52;c;%s\007" "$encoded"
}
# 2. Login to GitHub with GitHub CLI
if ! gh auth status &> /dev/null; then
echo "Please login to GitHub:"
# Get device code first, then copy and open browser
gh auth login --web --git-protocol https 2>&1 | while IFS= read -r line; do
echo "$line"
# Extract and copy the one-time code
if [[ "$line" =~ ([A-Z0-9]{4}-[A-Z0-9]{4}) ]]; then
osc52_copy "${BASH_REMATCH[1]}"
echo "✓ Code copied to clipboard!"
fi
done
fi
# Add settings GitHub CLI Credential helper to git
gh auth setup-git
GIT_TOKEN=$(gh auth token)
# 3. Install Ansible
echo "Installing Ansible..."
sudo apt-get install -y ansible git
# 4. Execute ansible-pull
echo "Running Ansible-pull..."
ansible-pull -U "https://x-access-token:${GIT_TOKEN}@github.com/ytnobody/ansible-belike-ytnobody.git" local.yml
echo "--------------------------------------------------"
echo "All set! Please run 'claude auth login' to finish."
echo "--------------------------------------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment