You need people to properly secure their keys of course, but it makes life a lot harder for an attacker.
When you git pull, then do your work and git commit/push, if you are not careful and you do not examine git status/diff you could sign and commit the hackers change (that you pulled from the repo initially) along with your new changes. So care is required even with PGP signed commits.
This is another good reason to not interrupt developers while they are working. Doing so, makes mistakes such as this more likely.
> if you are not careful and you do not examine git status/diff you could sign and commit the hackers change
I assume he meant that you pull, get an auto merge and then inattentively sign it. With this, you confirm the hackers change with your signature.
You could add a push hook to only allow fully signed chains, but given that we are talking about a compromised server, this does not help.
Even if we assume the git server is completely malicious, I'm still not seeing a case where an attacker can hide a change because I didn't 'status/diff'. I'm open to considering attacks I haven't thought of though.
Requiring two-factor auth for the GitHub account should be good for this though.
Just to make sure that someone doesn't go in and find a PHP account with recent commits, then email you with a third party github account.
> Yesterday (2021-03-28) two malicious commits were pushed to the php-src repo [1] from the names of Rasmus Lerdorf and myself.
…and ends by saying:
> We're reviewing the repositories for any corruption beyond the two referenced commits. Please contact security@php.net if you notice anything.
Are you sure that using recent commits as confirmation is a good idea?