The answer that you linked does what you want it to do.
Try running this in a folder without a repository in it:
git ls-remote https://github.com/git/git
It should show you the references on the remote, even though you haven’t added a local repository with git init or done a git clone.
See more: https://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html