Retrieve latest git commit hash of a Github repository without cloning
git, github, github-api
Solution
Found the answer here thanks to @jszakmeister:
git ls-remote $URL HEAD
For my private repo, I had to use the following syntax instead of the URL:
git ls-remote git@github.com:ORG/PROJECT.git HEAD
Problem
Is it possible to remotely retrieve the latest commit hash of a Github repo without cloning it locally? I'm referring to something like the following you see at the top of all the repos in Github: Based on some older questions it seems that this may not be possible with `git` directly (unless there's a new feature that enables it), so the right answer might involve using the Github API (turns out Github API won't work for my use case since I'll have to use a different set of credentials then the private key `git` uses).