How to Set Up and Use a .github Repository in a GitHub Organization
The .github
repository is a powerful and special repository in a GitHub organization. It allows you to manage reusable templates, shared workflows, and organization-wide settings. In this guide, we’ll walk through the steps to set up and leverage a .github
repository to improve your team’s efficiency and standardization.
What Is a .github Repository?
The .github
repository is a centralized place where you can define and share:
- Community health files (e.g.,
CODE_OF_CONDUCT.md
,CONTRIBUTING.md
). - Issue and pull request templates for standardizing contributions.
- Reusable workflows for GitHub Actions to streamline CI/CD pipelines.
- Organization profile page using a
README.md
.
This repository applies settings and templates across all repositories in your organization unless overridden.
Step 1: Creating the .github Repository
- Navigate to your organization’s GitHub page.
- Click New to create a repository.
- Name the repository
.github
(this must be the exact name). - Choose Private if you don’t want the repository visible to the public.
- Click Create Repository.
Step 2: Setting Up Community Health Files
Community health files apply across the organization, providing guidelines for contributors. Place these files in the root of the .github
repository:
- CODE_OF_CONDUCT.md: Defines behavioral expectations.
- CONTRIBUTING.md: Offers instructions for contributing to the organization’s projects.
- SECURITY.md: Describes how to report vulnerabilities.
- SUPPORT.md: Lists support channels or FAQs.
Example: CODE_OF_CONDUCT.md
# Code of Conduct
We are committed to fostering an inclusive and respectful community. Please read the following guidelines carefully to ensure a positive experience for everyone.
- Be respectful.
- Avoid harassment or discrimination.
- Report unacceptable behavior to admin@example.com.
Thank you for contributing!