AI NewsDev toolsAnnouncement

GitHub turns on SHA-256 repositories as a public preview on github.com

GitHub put SHA-256 Git repositories into public preview. The choice is made at repository creation and cannot be changed later.

AI News

Editorial3 min read

LinkedInX
GitHub Changelog post about SHA-256 Git repositories

Why it mattersA developer who wants a safer hash algorithm than SHA-1 no longer has to self-host Git to get one. The first new SHA-1 collision would make this decision for everyone.

A SHA-1 collision in a Git repository would reshape every team's week at the same time. GitHub put SHA-256 Git repositories into public preview today. A developer creating a new repository can now choose SHA-256 as the hash algorithm instead of SHA-1. The preview runs on github.com and on GitHub Enterprise Cloud with data residency.

Git itself has supported SHA-256 since version 2.30, released in 2021. The hosting side was the last part missing for most teams. A team that wanted a SHA-256 repository had to self-host its Git server.

What a developer picks and how

The choice is at repository creation. A new repository can be made on SHA-1 or on SHA-256, through the web interface or the GitHub API. When a developer clones it, Git picks up the right algorithm by itself. The object IDs on a SHA-256 repository are 64 hexadecimal characters, against 40 on a SHA-1 one. Anything that reads a commit ID by length has to handle both.

GitHub states one clear limit on the preview post. The post reads: "You can't change a repository's hash algorithm after you create it."

A team that puts a project on SHA-1 today keeps it on SHA-1. A migration from one algorithm to the other is not a feature of this release.

What has to be checked before using it

Four items before a team creates a SHA-256 repository. First, Git 2.30 or newer on every machine that reads the repository, including CI runners and developer laptops. Second, every tool that reads a commit ID has to handle a 64-character string. Scripts that pin an SHA-1 as a 40-character string will miss on the new one. Third, non-Git clients such as libgit2 have to support SHA-256 at the version the team uses. Fourth, the REST API endpoint reports which algorithm a repository uses, which is how a tool can tell them apart.

Why this matters even though SHA-1 looks fine

The reason a Git repository uses a cryptographic hash is to identify a commit uniquely. If two different commits hash to the same ID, a repository's history can be rewritten under a reader's nose. The SHAttered attack in 2017 was the first public SHA-1 collision. No equivalent attack against a Git repository has landed since. SHA-1 looks fine today.

The useful frame is that an algorithm has to be replaced before it is broken, not after. A repository created on SHA-1 today is ten years of history that will have to move later. A repository created on SHA-256 is history that does not need to move. GitHub writes that SHA-256 "will become the default for new repositories in Git 3.0". That is a Git team statement, not a GitHub team one. The Git 3.0 release date is not stated on the GitHub post.

What to try first

A single low-stakes repository on SHA-256. A documentation site, an internal tool, a small library. Create one, clone it on a laptop and a CI runner, push a commit, open a pull request, merge it. Read the commit IDs on the GitHub UI and in any script that logs them. The ten-minute test finds every tool that cannot handle the 64-character ID. The next SHA-256 repository is the one that mattered.

Source

SHA-256 Git repositories are now in public preview, by GitHub.

This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.

Share
LinkedInX
Start a project