GitHub now lets you create SHA-256 Git repositories, in public preview
GitHub has opened a public preview of Git repositories that use SHA-256 instead of SHA-1 to identify commits and files. Existing repositories are unchanged, but tools that read commit IDs should be ready for 64-character IDs.
On this page
On 3 December 2026 GitHub opened a public preview of SHA-256 Git repositories. It is available on github.com and on GitHub Enterprise Cloud with data residency. A new repository can now use SHA-256, instead of SHA-1, to identify the commits and files it stores.
Why the hash matters
Git names every object it stores by a hash of its content. The commit IDs you see in a pull request, a deploy log or a webhook payload are these hashes. Git has used SHA-1 for this from the start.
In 2017 Google announced the first practical SHA-1 collision, known as SHAttered: two different files that produce the same SHA-1 hash. GitHub cites this attack as the reason for the change. Git added SHA-256 support in version 2.30, released in December 2020, and GitHub says SHA-256 is planned to become the default for new repositories in Git 3.0.
What GitHub has added
- A choice when you create a repository. In the web interface or through the API, you can pick SHA-1 or SHA-256.
- An API parameter. The REST endpoints that create a repository, for a user or an organization, take a
hash_algorithmparameter with the valuesha1orsha256. GitHub's documentation says SHA-256 requires Git 2.30 or newer. - A way to check. A new endpoint,
GET /repos/{owner}/{repo}/hash-algorithm, returns which algorithm a repository uses. - No extra steps to clone. Git reads the repository's format and uses it automatically.
What stays the same
- Existing repositories keep SHA-1. Nothing is converted for you.
- The choice is permanent. A repository's hash algorithm cannot be changed after it is created.
- SHA-1 is still on offer. If your environment is not ready, you can keep creating SHA-1 repositories.
- It is a preview. GitHub's REST documentation says SHA-256 repositories are in preview and subject to change.
Git's own documentation adds two points. SHA-1 is still the default when you run git init, and SHA-256 is available "if enabled" in your build of Git. It also says that at present "there is no interoperability between SHA-256 repositories and SHA-1 repositories". The Git project says it now expects only compatible changes to SHA-256 repositories, and that repositories made with today's Git should be usable by future versions without data loss.
Longer commit IDs
A SHA-1 object ID is 40 hexadecimal characters. A SHA-256 object ID is 64. GitHub asks anyone whose tools read object IDs from API responses, webhooks or other sources to update them so they accept both lengths. It also asks you to confirm that any other Git implementation you rely on, such as libgit2, supports SHA-256.
What it means for your site
- Nothing changes today for sites you already run. Their repositories stay on SHA-1, and you do not need to act.
- Check your whole chain before you choose SHA-256. That means your local Git version (2.30 or later), your CI, your hosting or deploy service, and any library that reads Git data. If one link does not support SHA-256 yet, stay on SHA-1 for now. Because the choice cannot be undone, it is easier to wait than to rebuild a repository later.
- Look for code that assumes 40 characters. Deploy scripts that tag a build with its commit, webhook receivers that store commit IDs, database columns sized to 40 characters and validation rules with a fixed-length pattern are the usual places. Accept both 40 and 64.
- Try it on a test repository first. Locally,
git init --object-format=sha256creates one, so you can push it through your own pipeline and see what breaks before a client project depends on it. - Record the choice. For agencies that create repositories for clients, note which algorithm each new repository uses. The hash-algorithm endpoint lets you check this from a script.