STK-51Default Free tier
Use Git on GitHub for version control and code hosting
Keep every repository in Git, hosted on GitHub, with the default branch protected.
Review by
2027-04-30
How to do it
Git has been in use since 2005 and released 2.56.0 on 28 September 2026. It is free software under the GPL-2.0 licence. GitHub launched in 2008 and is the most used collaboration tool in the Stack Overflow Developer Survey 2025, at 81.1% of all respondents. Every AI coding tool knows Git commands and the GitHub pull request flow. The way out is simple, because git clone --mirror copies the full history to any other host. Protect the main branch as Protect the main branch says. We keep GitHub as the pick even though it is proprietary. GitLab Community Edition is open source under MIT and includes CI. Hosting it yourself means running, backing up and upgrading a large server, and AI tools know the GitHub flow best. Choose something else when you must host code on your own servers. Then pick GitLab Community Edition. GitLab came third in the same survey at 35.6%.
Examples
Shell example
git clone --mirror git@github.com:example/shop.git
cd shop.git && git push --mirror git@backup.example.com:example/shop.git
YAML example
# .github/CODEOWNERS is plain text, the branch rule lives in the repository settings
# Export the settings as code with the GitHub API so a move keeps them
branch: main
required_reviews: 1
required_checks: [test]
How to check
git --version on every developer machine and CI runner prints a release from the last six months. A mirror clone of each repository to a second host finishes without errors, run in the last 12 months.
Sources
Related rules
- ENG-15 Protect the main branch in Engineering
- STK-107 Use Harbor or your code host's registry for container images in Software choices
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/delivery-and-infrastructure/git-on-github">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.