GitHub opens SHA-256 Git repositories in public preview
New repositories on github.com and GitHub Enterprise Cloud with data residency can now use SHA-256 instead of SHA-1 as their hash algorithm.

Users can now choose SHA-256 instead of SHA-1 as the hash algorithm for new repositories. Repositories that already exist on GitHub stay on SHA-1.
Git identifies objects with a hash algorithm, and SHA-1 has long been the standard choice. According to GitHub, cryptographic advances and attacks such as SHAttered exposed weaknesses in SHA-1. Git added SHA-256 repositories in version 2.30, which shipped in December 2020. GitHub says Git 3.0 will make SHA-256 the default for new repositories.
When creating a repository, users can pick SHA-1 or SHA-256 in the web interface or through the GitHub API. Cloning needs no extra step, because Git matches the repository's algorithm on its own. GitHub says the hash algorithm of a repository cannot change after creation.
What to check first
Before creating a SHA-256 repository, GitHub tells users to make sure their environment is ready. SHA-256 object IDs are 64 hexadecimal characters long, compared with 40 for SHA-1. GitHub recommends Git 2.30 or later. Teams should also confirm that other Git implementations they rely on, such as libgit2, support SHA-256 repositories.
GitHub says any tool that parses IDs from API responses or webhooks must accept both 40- and 64-character forms. A REST API endpoint returns the hash algorithm of a given repository. Teams whose environments are not ready can keep creating SHA-1 repositories.
