Skip to content
NWM.NEW WEB MEDIA
EN/KO

GitHub begins public preview support for SHA-256 Git repositories

In brief

GitHub has begun supporting SHA-256 Git repositories in public preview on github.com and on GitHub Enterprise Cloud with data residency.

1 min read

Edited by Seung Kim

Translated from the Korean original. Read the original in Korean

Why it matters

  • With SHA-1's weaknesses well known, users can now choose a more secure hash algorithm for new repositories.
  • SHA-256 is set to become the default for new repositories from Git 3.0, so users can start checking their tools and integrations now.

By the numbers

64 characters
SHA-256 repository object ID length
40 characters
SHA-1 repository object ID length
Git 2.30
Minimum version supporting SHA-256 repositories

Key details

When creating a new repository, users can choose between SHA-1 and SHA-256 as the hash algorithm in the web interface or the GitHub API. When a repository is cloned, Git automatically applies the same algorithm as the GitHub repository. The algorithm cannot be changed after a repository is created, and existing repositories continue to use SHA-1.

Context

Git has long used SHA-1 to identify objects. After cryptographic attacks such as the SHAttered attack exposed weaknesses in SHA-1, Git introduced SHA-256 repositories in version 2.30, released in December 2020. The environment in use must run Git 2.30 or later, and users should also check whether other Git implementations such as libgit2 support SHA-256 repositories. Tools that read object IDs from API responses, webhooks and similar sources must be updated to handle both 40-character and 64-character IDs. The algorithm a repository uses can be looked up through a REST API endpoint, and users can keep creating SHA-1 repositories if their environment is not ready.

What's next

  • Git 3.0 is released, making SHA-256 the default for new repositories.

Sources

About this articleShow
Editor
Seung Kim
Primary sources
1
Version
r1

If anything in this article is wrong, please request a correction.

#GitHub#Git#SHA-256#security