Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are step‑by‑step instructions to reduce the number of Owners in a GitHub organization using the GitHub web console (UI).
These steps fully remediate the “excessive number of owners” issue using the GitHub web console.
1. Prerequisites and planning
- Ensure you are currently an Owner of the organization.
- Decide:
- Who should remain as Owners (usually 2–3 trusted admins, for redundancy).
- Which users should be downgraded to:
- Member, or
- Team maintainer (via teams) if they only need repo-level admin capabilities.
2. List and review current Owners
- Sign in to GitHub:
https://github.com. - In the upper-right corner, click your profile picture → Your organizations.
- Click the organization name you want to manage.
- In the org view, click the People tab.
- Filter by role:
- On the right side (or top filters), use Role filter and select Owner.
- This shows all current Owners.
3. Change a user from Owner to Member
For each user who should no longer be an Owner:- On the People tab (with Owner filtered), find the specific user.
- On the right side of that row, click the … (actions) menu.
- Click Change role (or similar wording depending on UI version).
- In the role selection dialog:
- Change role from Owner to Member.
- Click Save or Update role.
4. Use Teams instead of more Owners (optional but recommended)
For users who previously were Owners only to manage repositories:- Still in your organization, click the Teams tab.
- Either:
- Create a new team: New team → give it a name (e.g.,
org-admins,platform-team) → set appropriate repository access; or - Use an existing team.
- Create a new team: New team → give it a name (e.g.,
- Add the downgraded users as Maintainers of that team:
- Open the team → Members → Add a member.
- After adding, change their role in the team to Maintainer if they need to manage team members and repo access.
5. Verify minimum Owners and test
- Go back to People → filter by Owner and confirm:
- Only the intended small set of users remain as Owners.
- Validate:
- Owners can still manage billing, security settings, and org‑level apps.
- Former Owners (now Members) can still perform their daily tasks via:
- Repo admin permissions, and/or
- Team maintainer roles.
These steps fully remediate the “excessive number of owners” issue using the GitHub web console.
Using CLI
Using CLI
Below is a concrete, minimal workflow to reduce excessive GitHub organization owners using the GitHub CLI (
Save them for reference:
Create a
Verify:Ensure only the expected minimal set of owners remains.
gh).0. Prerequisites
- You are currently an organization owner.
- You have
ghinstalled and authenticated:
1. Identify all organization owners
ReplaceORG_NAME with your org:2. Decide who should remain owner
Manually editowners.txt into two files:owners_to_keep.txt– minimal set of true owners (e.g., 2–3 people, break-glass account).owners_to_downgrade.txt– everyone else.
3. (Optional) Validate each user still needs org access
If you want to completely remove some users from the org, list all members:members_to_remove.txt with logins that should be removed entirely (not just downgraded).4. Downgrade unnecessary owners to members
This keeps them in the org but removes owner privileges:5. (Optional) Remove users from the org completely
If some users no longer need any access:6. Enforce stricter process for new owners (policy level)
Not CLI-enforced, but recommended:- Document criteria and approval path for making someone an owner.
- Restrict changes to owners via change management / tickets.
- Periodically re-run step 1 and review owners.
Using Python
Using Python
Below is a concise, step‑by‑step approach to remediate “excessive number of owners” in a GitHub organization using Python.Assumptions:
Use this to review who currently has owner rights.
Notes:
If you share your org name pattern and whether you’re on GitHub.com or GitHub Enterprise Server, I can adjust the script to fit that environment exactly.
- You’re working with a GitHub organization, and “owners” = members with the
admin(owner) role in that org. - You have a Personal Access Token (PAT) with at least
admin:orgscope. - You want to enumerate all owners, then demote selected ones to regular members.
1. Plan and prerequisites
- Identify which users must remain owners (e.g., 2–3 primary admins, break-glass accounts).
- Get a GitHub PAT with:
admin:org(Organization members and teams)
- Install PyGithub:
2. List all organization owners with Python
3. Define who should stay as owners
Create a Python list of logins that must remain owners (never demote them):4. Demote excessive owners to members
org.update_membership(user, role="member")changes a user’s role from owner (admin) to regular member.- You must keep at least one owner; GitHub will not allow an org without any owners.
5. Optional: Dry run mode (safety check)
Before actually changing roles, you can run a dry run:6. Post‑remediation validation
-
Re‑list owners to confirm:
-
Ensure:
- Only the intended minimal set of owners remains.
- Other users still have appropriate team/repo permissions (e.g.,
maintain,write) instead of org‑wide owner.
If you share your org name pattern and whether you’re on GitHub.com or GitHub Enterprise Server, I can adjust the script to fit that environment exactly.
Using Terraform
Using Terraform
role from "admin" to "member" does not force resource replacement; Terraform will plan an in-place update showing role: "admin" => "member" for each demoted user.
