Open Source on IBM i

Java Git Client on IBM i

For sure everybody heard about the Open Source PTFs with the git client and node package, etc. But if you just want to use git to pull some code from a repository you could have had that feature for years without installing any extra PTF.

Eclipse JGit project

Some people may actually know that project and probably everybody thought that it is "just" a plugin project for the Eclipse platform.

But you are wrong!

The project is a pure Java lightweight implementation of Git (client and server) and on top of that it also features a usable git client as a subproject.

Installation

Just copy the jar file jgit.sh from https://eclipse.org/jgit/download/ to your IBM i server. For a rudimentary installation you are already finished. Java should be installed already on your server. The file has the extension sh but it really is a JAR file.

You can check your installation with the following

java -jar jgit.sh

I like to create a wrapper shell script named jgit which does something like

java -jar jgit.sh $*

$* means that it will pass all parameters from the scrip to the Java application. I like to put the shell script into a folder either in my home directory or at something like /usr/local/bin. Then adjust the PATH variable to include that folder. You can do this in the .profile file in your home directory. If you have none just create one and add

export PATH=$PATH:/usr/local/bin

or use any other folder you put the script file in.

.profile should have a CCSID which is PASE compatible like 819 or 850. You can check this with

attr /home/myname/.profile | grep CCSID

Now you can use the script from anywhere just by typing

jgit command parameter

Note: Pulling from repositories was no problem in my cases but committing my changes didn't work (probably due so some CCSID issue).

Happy cloning!

Mihael

Tags : git