Is there a way to programmatically download a single file from a remote git repository, in Java?
I was able to do something similar with Subversion using SVNKit and I've seen there is a pure java implementation of git (eclipse's JGit) which might be able to do something similar, so I hope there is a positive answer; though from what I understand about how git works - allowing updates only from local repositories - this could prove to be problematic.
git isn't really designed for single file access from a remote repository but you can abuse git archive
for this. The downside is that you have to download a "tree" rather than just the blob that you need.
E.g.
git archive --remote=url://to.git.repo branch path/to/dir | tar -x file
As an alternative, if you have gitweb set up on the remote repository you can use a simple curl or wget command to download any file in its "raw" format.