Reputation: 431
Attempting to load https://domain/path/project.git/HEAD
gives me a 404 on both bitbucket and github, and according to the git book (git-scm.com), this should not be the case.
Are these two sites a special case or am I doing something wrong?
Please note that I want to avoid downloading the entire repository if possible.
Upvotes: 1
Views: 143
Reputation: 25855
What you're trying to do assumes the old Git HTTP protocol, which simply used static files. Github and Bitbucket use Git's newer HTTP protocol, with an active (programmed) server, so there's no URL named "HEAD".
Therefore, you need to at least communicate with it using a smart client. That's not necessarily to say that you need to clone the repository, however; there may well be tools to talk with the server without having to do a full clone. For example, there's git ls-remote
:
$ git ls-remote http://server/git/project
7f38468acf1de9b73d931aebf9a8add8f691a6dc HEAD
7f38468acf1de9b73d931aebf9a8add8f691a6dc refs/heads/master
For further information, see the manpage for git-http-backend
.
(Also, it should be noted that if all you want to avoid is "downloading the entire repository", then you could simply do a shallow clone.)
Upvotes: 1
Reputation: 2755
This can be done with the Github API. Simply call a GET with basic auth (if needed) to /repos/:owner/:repo/commits
and parse the JSON response
I understand your question was regarding HTTP...this is just an alternative. I don't believe it's possible otherwise.
Upvotes: 0