Way to add new GitHub repositories automatically to a team

automationgithub

Say I have an organization on GitHub called ORG and a team comprising of all members in the org called TEAM_ORG.

I would like any number of repositories that I ever create under the ORG GitHub account, to be associated with TEAM_ORG automatically, such that the team members can read/write to it.

Is there a way to do so?

(I think the API could be used to build something – https://developer.github.com/v3/orgs/teams/#add-team-repo, but someone already solved this out there somewhere?) 🙂

Best Answer

GitHub's repo creation page walks through examples of using the API to automatically assign repos to org on creation:

https://developer.github.com/v3/repos/#create

Also, be sure to doublecheck permission settings on the organization members. By default, all organization members can create repositories for the organization. However, this can be overridden and repository creation permissions can be restricted to organization owners only. See "Repository permission levels for an organization."