Git & Repository Management Commands

Repository Visibility

Check which repos are public or private across all remotes.

GitLab

# List all repos with visibility (up to 100)
glab repo list --per-page 100 --output json | jq -r '.[] | "\(.visibility)\t\(.path_with_namespace)"'

# Filter for specific repo
glab repo list --per-page 100 --output json | jq -r '.[] | "\(.visibility)\t\(.path_with_namespace)"' | grep domus

# Via API (alternative)
curl -s "https://gitlab.com/api/v4/users/EvanusModestus/projects?per_page=100" | jq -r '.[] | "\(.visibility)\t\(.name)"'

GitHub

# List all repos with visibility
gh repo list --limit 100 --json name,visibility -q '.[] | "\(.visibility)\t\(.name)"'

# Or with jq
gh repo list --limit 100 --json name,visibility | jq -r '.[] | "\(.visibility)\t\(.name)"'

# Sort by visibility
gh repo list --limit 100 --json name,visibility | jq -r '.[] | "\(.visibility)\t\(.name)"' | sort

Gitea (Self-Hosted)

# Via API (replace URL with your Gitea instance)
curl -s "https://gitea-01.inside.domusdigitalis.dev/api/v1/users/evanusmodestus/repos" | jq -r '.[] | "\(.private)\t\(.name)"'

Multi-Remote Operations

Push to All Remotes

# Using gpall alias (defined in shell config)
gpall

# Manual push to all remotes
for remote in origin gitlab gitea; do
  git push "$remote" main
done

Check Remote URLs

# List all remotes
git remote -v

# Show specific remote
git remote get-url origin
git remote get-url gitlab
git remote get-url gitea

Add Standard Remotes

# Standard domus-* repo remote setup
REPO_NAME="domus-example"

git remote add origin git@github.com:EvanusModestus/${REPO_NAME}.git
git remote add gitlab git@gitlab.com:EvanusModestus/${REPO_NAME}.git
git remote add gitea ssh://git@gitea-01.inside.domusdigitalis.dev:2222/evanusmodestus/${REPO_NAME}.git

Repository Sync

Force Sync GitLab/Gitea from GitHub

# Fetch from origin (GitHub) and push to mirrors
git fetch origin
git push gitlab main --force
git push gitea main --force

Check Sync Status

# Compare local with all remotes
for remote in origin gitlab gitea; do
  echo "=== $remote ==="
  git fetch "$remote" 2>/dev/null && git log --oneline HEAD.."$remote/main" | head -3
done

Useful Aliases

Add to ~/.zshrc or ~/.bashrc:

# Push to all remotes
alias gpall='for remote in origin gitlab gitea; do git push "$remote" main; done'

# Quick repo visibility check
alias gh-vis='gh repo list --limit 100 --json name,visibility | jq -r ".[] | \"\(.visibility)\t\(.name)\""'
alias gl-vis='glab repo list --per-page 100 --output json | jq -r ".[] | \"\(.visibility)\t\(.path_with_namespace)\""'