How can I uniquely identify a git repository
As you can see in the related question; there is NO unique identification for a git repository. However; you could just compare the SHA-1 of the first commit on the master branch; that should suffice in 99.999% of all cases (supposing that the first commit will never be changed).
And if you want to be even more sure, you could consider using also the SHA-1 of the second commit; again supposing it will never change :). with the SHA-1 of the first two commits; I guess you have about 1 / 2^320 = 4.7*10^-97 chance of being wrong ...
If you are not sure there is even a master branch; you could suppose you have only one parentless root commit, and take its SHA-1. You can use this command to get the root commit (or commits):
git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$"
( copied from this answer)
or (easier to understand, thanks @TomHale):
git rev-list --parents HEAD | tail -1