> If someone malicious can make commits to your repo, you have a much worse problem than a possible hash collision.
This is exactly how GitHub works though: all repositories in a fork network share a single underlying repository, only the ref namespaces are separated.