I want to run git on a very old distro (Fedora 4). What I don't want to do is trigger a cascade of dependency installation in order to have the git binary run. So I'm looking for alternatives to the git binary, eg. in Java or Python. If there is anywhere I can get a 32 bit static build, that might also do what I need.
-
Just `rsync` the files over, or copy a tarball. You will have similar dependency issues via Java or Python because the fact of the matter is that you want _recent code_ and functionality _on an ancient system_. Something has got to give. – Dirk Eddelbuettel May 28 '16 at 15:24
-
The Java JRE is quite recent so I doubt I would face too many problems. – pinoyyid May 28 '16 at 15:39
-
1Build it from source. – Keith Thompson May 28 '16 at 21:18
3 Answers
I would like to suggest libgit2.
This lib is portable, pure C implementation of the Git core methods. It is 100% cross-platform and has zero dependencies. It has many language bindings, like: Ruby, Python, Node.js, and many more.

- 1,704
- 1
- 18
- 19
You can build git statically on another machine, with all the options you need; then you can easily transfer the resulting binary.
If you really want an alternative, there is JGit for Java, which provides most basic features in pure Java. However, this implementation is not feature-complete (at least the last time I looked), and thus will not interact properly with advanced git features, such as hooks.
-
I did try that the suggestions in that answer already, but the compilation failed and also gave warnings that there would still be dependencies on the target system. – pinoyyid May 28 '16 at 15:28
-
@pinoyyid weird, it worked for me (although I did not follow a particular SO post, I just linked the one that was there already). Without knowing what exactly went wrong while building, I'm afraid I won't be of much help. My (on 64bit for 64bit, cross-compiling to 32bit would need another change) process was something along the lines of `make clean; make configure ; ./configure --prefix=/staticroot CFLAGS="${CFLAGS} -static" NO_TCLTK=1 NO_GETTEXT=1 NO_PYTHON=1; make install` (prefixing is not necessary iirc) – dst May 28 '16 at 15:34
-
Rather than cross-compile to 32bit, I simply ran up a 32 bit Fedora instance on AWS. I don't recall the detailed errors, but the warnings that there would still be dependencies was enough to put me off proceeding with that option. I'll have a look at JGit. – pinoyyid May 28 '16 at 15:37
-
For future readers: you probably refer to [the problems of gethostbyname](http://stackoverflow.com/questions/15165306/compile-a-static-binary-which-code-there-a-function-gethostbyname), which are indeed inherent to any static linking with glibc. – dst May 28 '16 at 15:41
Many thanks for the suggestions.
Without going into the background, I really need to do as little as possible to the server in question. With this in mind, the approach I eventually took to my specific problem was to sshmount the directory concerned from a more modern server and run git there.

- 21,499
- 14
- 64
- 115