Git & Repository Management Commands
Table of Contents
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
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
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)\""'