GitHub just announced that GitHub SHA-256 repositories are now in public preview. When creating a new repo via the web interface or GitHub API, users can now choose either SHA-1 or SHA-256 as their hash algorithm.
However, this choice is permanent once you create the repo. You cannot change a repo’s hash algorithm later, nor can you convert an existing SHA-1 repo to SHA-256 in place. Instead, developers who want SHA-256 must create a fresh repo and migrate their code over.
A Stronger Alternative to Aging SHA-1 Hashes
At its core, Git uses hash values to tag commits, files, and other repo objects. Because researchers have already exposed collision flaws in SHA-1, Git introduced SHA-256 as a safer path forward.
According to GitHub, Git added SHA-256 repo support back in version 2.30. Looking ahead, Git 3.0 plans to make SHA-256 the default hash for every new repo. For now, GitHub still defaults to SHA-1 on new repos, while letting users opt into SHA-256 by hand.
Cloning and Forking Keep the Source Algorithm
Meanwhile, cloning a repo automatically adopts the remote repo’s hash type. Likewise, both clones and forks keep using the exact same hash algorithm as the parent repo.
Check Your Tools Before Creating a SHA-256 Repo
Before you switch, GitHub advises teams to check four key tool limits across their workflow:
- Git Version: Using SHA-256 repos requires Git 2.30 or newer. Cloning an empty SHA-256 repo requires Git 2.41 or newer.
- Repo Compatibility: Git cannot push or pull directly between repos that use different hash algorithms.
- Scripts and Tools: SHA-256 object IDs span 64 hex characters, whereas SHA-1 IDs span 40. Therefore, scripts, APIs, and webhook handlers that read commit or object IDs must handle both lengths.
- Creation Options: Neither GitHub CLI nor GitHub Desktop offers a SHA-256 creation option yet. For now, users must create SHA-256 repos on the GitHub web app or through the API.
Support Our Threat Intelligence
Find our tech and OS security coverage helpful? Support our work today and unlock a 100% ad-free reading experience!