You need not download the file itself to find its hash ID, but you do have to have access to the remote repository to find the file's hash ID. This access needs to be above and beyond that required for a simple git clone
: you need to be able to run git rev-parse
or read a tree object from them.
If you cannot do this, your best bet is to obtain the file (or the entire commit).
Note that if you do get the file from the commit, you can save the commit hash ID that delivered that copy of the file. If, in the future, you have the same commit hash ID, it contains the same file. This is not as good as checking the file's hash ID directly, since a different commit could contain the same copy of the file, but it's generally easier since commit hash IDs are easier to obtain.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…