Organizações
Como criar uma organização no GitHub
Download (clone) all repos from a GitHub organization, then delete the organization.
1. Clone / download all repositories
Best method: GitHub CLI (gh) — simplest and official.
-
Install GitHub CLI if you don’t have it.
-
Authenticate:
gh auth login(Choose HTTPS or SSH; for private repos you need appropriate scopes.)
gh auth status -
Clone everything:
# List and clone all repos (adjust limit if you have >1000)gh repo list ORG_NAME --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | xargs -L1 gh repo clone# List and clone all repos (adjust limit if you have >1000)gh repo list ORG_NAME --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | xargs -L1 -I {} gh repo clone {} -- --depth=1Or with GNU parallel for speed:
gh repo list ORG_NAME --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | parallel -j 8 gh repo cloneUseful flags:
--no-archived— skip archived repos--source— only non-forks- Add
--visibility private/publicif needed
Alternative (API + curl + git):
# Needs a Personal Access Token with repo + read:org scopes
export GITHUB_TOKEN=your_token_here
ORG=ORG_NAME
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/orgs/$ORG/repos?per_page=100&type=all" | \
jq -r '.[].clone_url' | while read url; do
git clone "$url"
done
(Handle pagination if you have >100 repos.)
Notes:
- This clones the default branch (or full history depending on how you clone). For a true mirror of all branches/tags use
git clone --mirror. - Issues, PRs, wikis, releases, etc. are not included in a plain
git clone. For full backups you need extra tools (e.g. GitHub migration exports on Enterprise, or third-party backup scripts). - Private repos require authentication and the correct permissions.
2. Delete the organization
This is irreversible. All repositories, issues, PRs, wikis, projects, packages, etc. are permanently deleted. The organization name is locked for 90 days.
Requirements: You must be an organization owner.
Steps (official):
- Go to GitHub → click your profile picture → Your organizations.
- Click the organization.
- Click Settings.
- Scroll to the Danger zone.
- Click Delete this organization.
- Read the warnings, type the exact organization name, and confirm.
Before deleting:
- Make sure you have local copies of everything important (repos + any other data you need).
- Consider transferring repos you want to keep to another account/org first.
- Optionally archive the organization instead of deleting (makes it read-only).
Official docs: Deleting an organization account.
Recommended order:
- Authenticate & clone/backup everything.
- Verify the local copies.
- Only then delete the organization.
If you need a full backup that includes issues/PRs/etc., say so and I can point you to more specialized tools.
Use this command:
gh repo list ORG_NAME --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | xargs -L1 -I {} gh repo clone {} -- --depth=1
Explanation
gh repo cloneaccepts extragit cloneflags after--.--depth=1creates a shallow clone (only the latest commit of the default branch).-I {}tellsxargsto replace{}with each repository name so the flags are passed correctly.
Optional improvements
Faster (parallel):
gh repo list ORG_NAME --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | parallel -j 8 gh repo clone {} -- --depth=1
Skip archived repos:
gh repo list ORG_NAME --limit 1000 --no-archived --json nameWithOwner --jq '.[].nameWithOwner' | xargs -L1 -I {} gh repo clone {} -- --depth=1
Clone into a specific folder:
mkdir -p my-org-backup && cd my-org-backup
gh repo list ELT73A-2024-2 --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | xargs -L1 -I {} gh repo clone {} -- --depth=1
Replace ORG_NAME with your actual organization name.
After cloning with --depth=1, you can remove all .git folders so you only keep the source code.
One-liner (recommended)
Run this from the directory that contains all the cloned repos:
find . -type d -name ".git" -exec rm -rf {} +
Safer version (shows what will be deleted first)
# Preview
find . -type d -name ".git"
# Then delete
find . -type d -name ".git" -exec rm -rf {} +
Alternative with xargs
find . -type d -name ".git" | xargs rm -rf
Full workflow (clone + remove .git)
# Create a base directory
mkdir -p ELT73A-LAB-TPL-backup
cd ELT73A-LAB-TPL-backup
# 1. Clone shallow
gh repo list ELT73A-LAB-TPL --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | \
xargs -L1 -I {} gh repo clone {} -- --depth=1
# 2. Remove all .git folders
find . -type d -name ".git" -exec rm -rf {} +
After this, each repository folder will contain only the code (no Git history, no ability to git pull or push).
Here’s the adapted version for organizations ELT73A-2025-1-A through ELT73A-2025-1-X:
- Creates a folder for each organization (
ELT73A-2025-1-A,ELT73A-2025-1-B, …). - Clones every repository inside that org with
--depth=1. - Deletes all
.gitfolders so only the source code remains. - Moves to the next organization.
Skip orgs that don’t exist / have no access (avoids errors):
# Create a base directory
mkdir -p ELT73A-S22-2026-1-backup
cd ELT73A-S22-2026-1-backup
# Loop from A to X
for letter in {A..X}; do
org="ELT73A-S22-2026-1-$letter"
# Skip if the org doesn’t exist or you have no access
if ! gh api "orgs/$org" &>/dev/null; then
echo "Skipping $org (not found or no access)"
continue
fi
echo "=== Processing $org ==="
mkdir -p "$org"
cd "$org"
gh repo list "$org" --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | \
xargs -L1 -I {} gh repo clone {} -- --depth=1
find . -type d -name ".git" -exec rm -rf {} +
cd ..
done
Faster cloning with parallel (if you have GNU parallel installed):
gh repo list "$org" --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | \
parallel -j 8 gh repo clone {} -- --depth=1
Just paste the script into your terminal and run it.
Uma org por grupo vs. times em uma única org
Para o seu caso (labs lab00…lab10, templates, PlatformIO/STM32, automação com gh), quase sempre a melhor opção é uma única organização com times (Grupo-A, Grupo-B, …).
Comparação rápida
| Critério | 1 org por grupo (ELT73A-S22-2026-2-A, …) | 1 org + times (ELT73A-S22-2026-2 + grupo-a) |
|---|---|---|
| Isolamento entre grupos | Muito forte | Bom (repos privados + permissão só do time) |
| Administração | Pesada (N orgs) | Simples (1 org) |
| Criar labs em massa | Script por org ou loop em N orgs | Um loop só, mais simples |
| Templates | Org de templates à parte ou copiar N vezes | Um lab00-template na mesma org |
| Times / membros | Cada org tem seus membros | Times nativos + membership fácil |
| Visão do professor | Trocar de org o tempo todo | Tudo num só lugar |
| Limites do GitHub | Risco de bater limite de orgs / convites | Bem mais confortável |
| Billing / settings | Repetir política N vezes | Configurar uma vez |
| Autograding / CI | Disperso | Centralizado |
| “Aluno não vê o outro” | Natural | Com repo privado + só o time no repo, também ok |
| Complexidade para o aluno | URLs longas, várias orgs | Um padrão: lab00-grupo-a |
Uma org por grupo
Vantagens
- Isolamento máximo (um grupo não “existe” na org do outro).
- Cada grupo pode ter settings próprios (se um dia precisar).
- Modelo parecido com “cada time = uma conta/org”.
Desvantagens
- Muitas orgs para criar, convidar alunos e manter.
- Scripts e docs ficam mais longos (
ELT73A-S22-2026-2-A/LAB05, …). - Template costuma ficar em outra org (
ELT73A-LAB-TPL) e o fluxo--template/ permissões complica. - Professor perde visão única (issues, Actions, busca de repos).
- No plano educacional/free, gerenciar dezenas de orgs vira atrito real.
Faz sentido quando: grupos são projetos longos, quase independentes, com admins diferentes, ou há requisito formal de isolamento total.
Uma org + times (Grupo-A, Grupo-B, …)
Vantagens
- Um só lugar para templates, labs e projeto.
- Times do GitHub são feitos para isso: membros + permissão em repos.
- Automação simples (
lab00-grupo-a…lab00-grupo-x). - Aluno clona um padrão fixo; professor lista tudo com um
gh repo list. - Fácil conceder
pushsó ao time certo. - README, CI e componentes Docusaurus ficam estáveis.
Desvantagens
- Todos os grupos “moram” na mesma org (nomes de repo precisam ser claros).
- Se alguém errar permissão e deixar um repo interno/público demais, o isolamento cai — exige disciplina no script (
private+ teampushsó no repo do grupo). - Alunos da org podem, em alguns casos, ver que a org existe e listar o que a política da org permitir (repos privados de outro time continuam inacessíveis sem permissão).
Faz sentido quando: turma de disciplina, vários labs, mesmo professor, automação e templates — o seu cenário.
Isolamento de verdade (o que importa na prática)
O que impede o Grupo B de ver o código do Grupo A não é “org separada” por si só; é:
- Repositório private
- Time só do grupo com acesso (
push/pull) - Alunos não serem owners da org
- Scripts que nunca adicionam o time errado
Com isso, 1 org + times isola tão bem quanto N orgs para uso acadêmico normal.
Recomendação para ELT73A / S22
| Escolha | Recomendação |
|---|---|
| Padrão da disciplina | 1 organização ELT73A-S22-2026-2 + times Grupo-A … Grupo-X |
| Repos | lab00-template, lab00-grupo-a, …, projeto-grupo-a |
| Alunos | Membros do time; não owners |
| Templates | Na mesma org, marcados como template |
| Docs (Docusaurus) | Componente com abas por grupo, como o LabTeamMembers |
Use 1 org por grupo só se houver regra institucional de isolamento extremo ou cada grupo for um “mini-projeto” com gestão própria o semestre inteiro.
Resumo em uma frase
Para laboratórios de uma turma: uma org com times é melhor — menos trabalho, melhor automação, templates simples e isolamento suficiente com repos privados. Uma org por grupo só compensa se o isolamento administrativo total valer o custo operacional.