When I run git clone , how can I assure myself that the code I checked out is the same as the code that's on GitHub?
The easiest way is to use git log
, look at the commit hash at the top and compare it to the hash of the latest commit on GitHub.
Would it suffice to just compare commit hashes?
Git uses SHA1. It is possible to cause collisions so that a hacker creates something else with the same commit hash. Another possibility is to create commits with a hash not matching the data.
Assuming that my git installation isn't malicious, should I just assume that git has me covered?
But as long as you use HTTPS/SSL no one has stolen the SSL certificate (if someone would have stolen thr one from GitHub, this would be a very big thing and he could also change the web UI), git clone
will not check out anything else (assuming you use the correct URL).
If you use HTTP, you don't have the protection from an SSL certificate and someone else could send you anything else.