Git Course 0%

Organizations, teams, repositories

Beginner GitHub UI ≈ 9 min

What you will learn

  • The difference between a personal repository and an organization's
  • What teams are for, and why access is granted to teams rather than people
  • How a repository's address is built, and what changes when it moves

After this lesson you can

  • I can find my way around an organization and explain who has access to what

Why this matters

Everything on GitHub hangs off two containers: an account and a repository. Understanding how teams sit between them is what lets you answer "who can see this?" and "where should this new repository live?" without guessing.

The shape

GitHub organizations, teams and repositories An organization called northwind-trails contains two repositories, trailguide and trailguide-web, and two teams, docs and engineering. Each team is given a role on a repository: the docs team has Write on trailguide and Read on trailguide-web, and the engineering team has Write on trailguide-web. People are put in teams, so access is managed once per team rather than once per person. A note says repositories never nest: unlike GitLab subgroups, teams can be nested but every repository sits directly in the organization. Organization: northwind-trails github.com/northwind-trails TEAMS Team: docs Ana, Chloe Team: engineering Ben, Dev REPOSITORIES trailguide …/northwind-trails/trailguide trailguide-web …/northwind-trails/trailguide-web Write Write Read People join teams; teams are given a role on a repository. Add someone once, to the team. Teams can be nested; repositories cannot. Every repository sits directly in the organization. GitLab's nearest equivalent is a group, which does contain subgroups and projects.
People join teams, teams get a role on a repository, and repositories sit directly in the organization.
Thing Is Contains
Personal account You Your own repositories
Organization A company, team or community Repositories, teams, members, billing
Team A named group of people inside an organization Members, and access to repositories; can contain other teams
Repository One project's Git repository plus its issues, pull requests and settings Code, branches, tags, releases, wiki, Actions

The address follows the container: github.com/<owner>/<repository>, where the owner is your username or the organization name. There is exactly one level; a repository is never inside another repository or inside a team.

Personal or organization?

Anything with more than one contributor belongs in an organization, even a small one. The reason is ownership rather than features: a repository in a personal account belongs to that person, and when they leave, so does it. Organization repositories outlive their members.

Free organizations are enough for most teams. Private repositories, unlimited collaborators and Actions minutes are all included; the paid tiers add rulesets on private repositories, required reviewers, and audit tooling.

Teams

A team is how an organization avoids managing access one person at a time. Give the docs team Write on the documentation repositories, and every writer who joins the team gets it automatically.

Two features earn their keep:

  • Nested teams. A docs team inside an engineering team inherits its parent's repository access, so a child team can only add access, never remove it.
  • Mentions. Writing @northwind-trails/docs in an issue or pull request notifies the whole team, which is the correct way to ask "someone from docs, please look".

Teams also power code owners: a CODEOWNERS file can name a team as the required reviewer for a path (lesson 10.5).

Repositories

What sits inside one, beyond the files:

Part What it is
Code The Git repository: branches, tags, commits
Issues Work items (lesson 10.6)
Pull requests Proposed changes (lesson 10.7)
Actions Automation (lesson 10.10)
Wiki, Projects, Discussions Optional, switched on per repository in Settings
Settings Access, branches and rulesets, secrets, Pages

A repository can be transferred to another owner, and can be forked into your own account, which is how contribution to projects you cannot push to works (lesson 7.7).

Renaming and moving

GitHub redirects the old address after a rename or transfer, both for the web and for Git, so a clone with the old remote keeps working. That is a courtesy, not a guarantee: update your remote, because the redirect stops the moment someone creates a new repository with the old name.

Terminal
$ git remote set-url origin git@github.com:northwind-trails/trailguide.git

How to do it

Nothing here is a Git command, but the address you clone is where the structure shows up:

Terminal
$ git clone git@github.com:northwind-trails/trailguide.git

Owner then repository, always two segments. If someone gives you a GitLab-style path with three or more, it is not a GitHub URL.

Common mistakes

  • A shared project in a personal account. It leaves when its owner does.
  • Adding people to repositories one at a time, then discovering nobody knows who has access to what.
  • Assuming repositories nest. They do not; a docs/style-guide repository is one repository whose name contains no slash.
  • Relying on the redirect after a rename. Update the remote.
  • Creating a team per repository. Teams should map to people who work together, not to the code.

Try it yourself

Goal: see the structure from the inside.

  1. Open an organization you belong to, or create a free one for practice.
  2. Look at People, Teams and Repositories, and work out which of the three gives you your access.
  3. Create a team, add yourself, and give it Read on one repository.
  4. Check the repository's Settings → Collaborators and teams and find your team listed.
  5. Compare the repository's URL with a GitLab project URL from lesson 9.2 and note the difference in depth.

Expected result: you can name the path by which you have access to a repository: directly as a collaborator, through a team, or as an organization owner.

Show solution

Step 2 is the point. On a well-run organization the answer is almost always "through a team", and that is the sign of access being managed rather than accumulated. If the answer is "I was added personally to eleven repositories", that is a good thing to raise.

Check yourself

1. Where do repositories sit on GitHub?
2. What is the advantage of granting repository access to a team instead of a person?
3. A repository was renamed. Your existing clone still pushes. Why, and what should you do?

Key terms

Repository (repo) Project Fork