If HEAD doesn't exist in the remote repository, then you likely want:
git ls-remote $URL refs/heads/master
Note that in the first instance, HEAD is going to point to the default branch to checkout in the repository. You need to be sure that's the branch you want, or just use the second form and specify the one you want (replace refs/heads/master with the name of the branch you want: refs/heads/BRANCH_NAME.
The short hash of the last commit id is much more human readable (read: user friendly). For posterity, two ways to get the short hash of the last commit id: