Myth: Git needs SHA-256 because SHA-1 collisions put your source code at risk. GitHub co-founder Scott Chacon takes that apart in Git 3.0’s upcoming SHA-256 default will be a costly mistake.
Git 3.0 moves its default content hash from SHA-1 to SHA-256. Chacon argues the switch will cost years of broken tooling. The threat it stops barely resembles how real attacks on source code happen.
Table of Contents
- Why SHA-1 sounds like a threat to your Git repos
- Why real attacks on source code don’t need a collision
- Where the “theoretical” label falls short
- What’s actually true: the migration cost is real
- Why compliance may be the real driver
- What to check before adopting any security upgrade
- FAQ
- Sources
Why SHA-1 sounds like a threat to your Git repos
Cryptographers call SHA-1 broken because of two published results. SHAttered in 2017 and SHA-1 is a Shambles in 2020 showed how to manufacture two different files with one hash. Chacon estimates the cost at a few tens of thousands of dollars in GPU time.
That word “broken” does a lot of work. Chacon is a co-founder of both GitHub and GitButler and the author of Pro Git. He wrote the post as a direct response to this breaking change.
He doesn’t call SHA-256 a bad hash. He says the industry is about to absorb an enormous migration cost. That means broken CI pipelines, forges that don’t support the new format and years of tooling churn. Next to real supply-chain attacks, he calls the attack it defends against “maybe the dumbest possible way to get untrusted code on a system.”
Why real attacks on source code don’t need a collision
Chacon’s central claim is that trust in Git was never rooted in the hash function. It comes from where you pull code from. He traces that idea back to Linus Torvalds at the project’s founding two decades ago.
Real attackers don’t rent GPU farms to engineer a hash collision, Chacon argues. They socially engineer their way into maintaining an already-trusted package. Or they simply pay off a tired open source maintainer.
He also separates two kinds of attack. A collision attack engineers two files with the same hash. A second-preimage attack must produce a malicious replacement for a file someone already trusts and has already pulled. He argues second-preimage attacks against SHA-1 remain effectively impossible. Most of what people worry about actually requires one.
Accidental collisions are even less likely. SHA-1’s 160-bit output would need roughly 1.4 septillion random files in a single project before two matched by chance. That’s why, across twenty years and billions of commits, nobody has ever recorded one, Chacon says.
Where the “theoretical” label falls short
The discussion pushed back on this framing. SHAttered was “specifically a practical proof of concept” in 2017, one developer pointed out. It wasn’t a theoretical result. Git projects escaped mainly because nobody bothered brute-forcing a Git-blob-shaped prefix. Git’s design didn’t make them immune.
The same developer challenged the split between collision and second-preimage attacks. A plain collision is already enough to smuggle malicious code once two repositories land on the same commit hash. That’s realistic when CI pipelines compare commits across forks.
Chacon replied under his own account. He stood by the “impractical to exploit” framing while agreeing the underlying papers are real. Another commenter added a technical wrinkle. The Shambles result is a chosen-prefix collision, which sits between Chacon’s two categories. Chacon acknowledged that distinction was fair.
What’s actually true: the migration cost is real
Whatever you make of the threat model, the cost side of Chacon’s argument held up well. One developer tried SHA-256 repositories about eighteen months before this conversation. CI runners and action tooling broke outright. They abandoned the experiment and rebuilt their repos under SHA-1.
Another commenter confirmed that GitHub doesn’t support SHA-256 repositories outside a closed beta. Several agreed that mixing SHA-1 and SHA-256 objects inside Git submodules has no settled solution yet. No public support on a popular host, plus an open submodule problem: that’s the concrete “costly mistake” in Chacon’s title.
Other developers pushed back on the “train wreck” framing using Git’s own documentation. One pointed to Git’s official hash-function-transition docs. They state that SHA-1 repositories keep working untouched. Only new repositories default to SHA-256, and the two hash representations are designed to map one to one. A reply called it “a perfect and user friendly migration strategy.” It asked what problem remained if existing SHA-1 workflows are left alone.
Why compliance may be the real driver
A third thread suggested the change has no live exploit behind it at all. SHA-1 is explicitly disallowed under compliance standards like FIPS 140-2 at some organizations, one commenter noted. That holds whether or not anyone has used it to attack them. If that’s accurate, procurement and certification requirements may be doing as much work here as the cryptography.
What to check before adopting any security upgrade
None of this makes SHA-256 a bad choice. Git’s maintainers aren’t wrong to move off SHA-1 eventually. My take is narrower: before adopting a breaking “security upgrade,” map the actual attack path first.
- Ask who would realistically attack you.
- Ask what they’d actually have to do to pull it off.
- Check whether the change addresses that path or a more theoretical one.
If your organization has to drop SHA-1 for compliance, that’s a real reason to migrate. Say so plainly instead of dressing it up as stopping an active threat.
If you’re deciding whether to flip Git 3.0’s new default on your own repos, read the thread first. The details about GitHub’s beta-only support and the submodule gap matter. They can turn a one-line config change into a week of debugging broken pipelines.
FAQ
Is SHA-1 actually broken in Git?
Mathematically, yes. SHAttered in 2017 and SHA-1 is a Shambles in 2020 showed researchers can manufacture two files with the same hash. Scott Chacon estimates the cost in the tens of thousands of dollars. Nobody has used that technique to insert malicious code into a real Git project. Accidental collisions remain effectively impossible at Git’s scale.
Should I switch my own repositories to SHA-256 right now?
Not without checking your tooling first. Commenters found that GitHub doesn’t yet support SHA-256 repositories outside a closed beta. CI runners and actions broke for early adopters. Mixing SHA-1 and SHA-256 objects inside submodules has no clean solution yet. Existing SHA-1 repositories keep working after Git 3.0 ships; only new repositories get the new default.
What’s actually driving Git’s move to SHA-256, if not a known exploit?
Some organizations explicitly disallow SHA-1 under compliance frameworks like FIPS 140-2, one commenter pointed out. That holds regardless of any demonstrated attack. That compliance pressure may be as large a driver as the underlying cryptography.
Sources
- Article: Git 3.0’s upcoming SHA-256 default will be a costly mistake, by Scott Chacon.
- Discussion: Hacker News thread, for the counterpoints on SHAttered’s practicality, the migration costs developers have already hit, and the compliance angle behind the change.