The post has been translated automatically. Original language: Russian
On December 3, 2026, GitHub opened a public preview of Git repositories in which objects are addressed with a SHA-256 hash instead of SHA-1. We got a new opportunity github.com and GitHub Enterprise Cloud hosting data in the selected region. This is the first step by the largest code hosting company towards a transition that Git itself has been preparing for a long time: according to GitHub, in Git 3.0, SHA-256 will become the default algorithm for new repositories.
Why change SHA-1
Each commit, tree, and file in Git receives an identifier — a hash of the contents. Historically, this is SHA-1, and its durability has been undermined by practical collision attacks; GitHub in the announcement directly refers to the SHAttered attack. Git itself has been able to create repositories on SHA-256 since version 2.30, released in December 2020, but it was inconvenient to use them in teamwork without hosting support. Now this gap is closing.
How it works
- The hashing algorithm is selected when creating the repository, either in the web interface or via the GitHub API: SHA-1 or SHA-256.
- You cannot change the algorithm for an already created repository.
- Existing repositories remain on SHA-1, there is no automatic migration.
- When cloning, Git determines the repository algorithm itself, there is no need to check anything in advance.
- The object identifiers in the SHA-256 repository consist of 64 hexadecimal characters, not 40 as before.
- You can find out the algorithm of an existing repository using a separate method of the GitHub REST API.
If the team's environment is not ready for the new format, you can continue to create repositories on SHA-1.
Environmental requirements
GitHub recommends Git version 2.30 or later. The company also asks you to check other Git implementations that you use, such as the libgit2 library: they must also support SHA-256 repositories. This applies to IDEs, graphical clients, CI runners, and any services that work with the repository other than through regular git.
The second part of the requirements concerns your own code. Anything that gets object identifiers from API responses, webhooks, or other sources needs to be taught how to work with both 40-character and 64-character values.
What does this mean in practice?
For a backend developer, the main risk is not in Git itself, but in the binding around it. Before starting the first repository on SHA-256, it is worth going through the places where the hash length could have been explicitly hardwired.:
- columns in databases for a commit hash of a fixed length of 40 characters — in PostgreSQL and MySQL, such fields will have to be expanded.;
- regular expressions in deployment scripts, hooks, and webhook handlers that check for exactly 40 hexadecimal characters;
- validation of input data in their APIs and integrations with task trackers, where the hash of the commit is inserted into links and messages;
- third-party tools in CI: collectors, scanners, changelog generators built on older versions of libgit2 or proprietary parsers.
Short hashes in interfaces and logs can also behave differently if the tool cuts or compares strings in length somewhere. A reasonable course of action is to create a SHA—256 test repository, run the entire pipeline from push to deployment through it, and see what breaks. Since the algorithm cannot be changed after creation, it is better to translate combat repositories only after such a run. There is no hurry for existing projects: they remain on SHA-1, and the default transition will appear with Git 3.0.
The draft text was prepared with the participation of AI, the facts were checked against the original source — the official GitHub Changelog.
3 декабря 2026 года GitHub открыл публичное превью репозиториев Git, в которых объекты адресуются хешем SHA-256 вместо SHA-1. Новую возможность получили github.com и GitHub Enterprise Cloud с размещением данных в выбранном регионе. Это первый шаг крупнейшего хостинга кода к переходу, который сам Git давно готовит: по данным GitHub, в Git 3.0 SHA-256 станет алгоритмом по умолчанию для новых репозиториев.
Зачем менять SHA-1
Каждый коммит, дерево и файл в Git получает идентификатор — хеш содержимого. Исторически это SHA-1, а его стойкость подорвана практическими атаками на коллизии; GitHub в анонсе прямо ссылается на атаку SHAttered. Сам Git умеет создавать репозитории на SHA-256 с версии 2.30, вышедшей в декабре 2020 года, но без поддержки на стороне хостинга пользоваться ими в командной работе было неудобно. Теперь этот пробел закрывается.
Как это устроено
- Алгоритм хеширования выбирается при создании репозитория — в веб-интерфейсе или через API GitHub: SHA-1 или SHA-256.
- Сменить алгоритм у уже созданного репозитория нельзя.
- Существующие репозитории остаются на SHA-1, автоматической миграции нет.
- При клонировании Git сам определяет алгоритм репозитория, заранее ничего проверять не нужно.
- Идентификаторы объектов в репозитории на SHA-256 состоят из 64 шестнадцатеричных символов, а не из 40, как раньше.
- Узнать алгоритм уже существующего репозитория можно отдельным методом REST API GitHub.
Если окружение команды к новому формату не готово, создавать репозитории на SHA-1 можно и дальше.
Требования к окружению
GitHub рекомендует Git версии 2.30 или новее. Отдельно компания просит проверить другие реализации Git, которыми вы пользуетесь, — например, библиотеку libgit2: они тоже должны поддерживать репозитории на SHA-256. Это касается IDE, графических клиентов, CI-раннеров и любых сервисов, которые работают с репозиторием не через штатный git.
Вторая часть требований касается собственного кода. Всё, что получает идентификаторы объектов из ответов API, вебхуков или других источников, нужно научить работать и с 40-символьными, и с 64-символьными значениями.
Что это значит на практике
Для backend-разработчика главный риск не в самом Git, а в обвязке вокруг него. Прежде чем заводить первый репозиторий на SHA-256, стоит пройтись по местам, где длина хеша могла быть зашита явно:
- колонки в базах данных под хеш коммита фиксированной длины в 40 символов — в PostgreSQL и MySQL такие поля придётся расширять;
- регулярные выражения в скриптах деплоя, хуках и обработчиках вебхуков, которые проверяют ровно 40 шестнадцатеричных символов;
- валидация входных данных в своих API и интеграциях с трекерами задач, где хеш коммита вставляется в ссылки и сообщения;
- сторонние инструменты в CI: сборщики, сканеры, генераторы журналов изменений, построенные на старых версиях libgit2 или собственных парсерах.
Короткие хеши в интерфейсах и логах тоже могут вести себя иначе, если инструмент где-то обрезает или сравнивает строки по длине. Разумный порядок действий — завести тестовый репозиторий на SHA-256, прогнать через него весь конвейер от пуша до деплоя и посмотреть, что сломается. Поскольку алгоритм нельзя сменить после создания, боевые репозитории лучше переводить только после такого прогона. Для существующих проектов спешить некуда: они остаются на SHA-1, а переход по умолчанию появится вместе с Git 3.0.
Черновик текста подготовлен с участием ИИ, факты сверены с первоисточником — официальный журнал изменений GitHub (GitHub Changelog).
Comments 2
Newest Popular