An editor to make changes to files on the IFS. For example, Rational Developer for i, Notepad++ with NppFTP, Orion or local machine connected to IBM i share.
5733OPS, option 6 - e.g. Git. (2019 update: install git through yum)
Setup an SSH key (read below)
Setting up your SSH key
An SSH key is a passphrase. You generate it on your IBM i, then upload it to GitHub. Then whenever you interact with your remote repo, it authenticates by making sure these keys match. Do not share your key.
Start an SSH session (ssh [USER]@[SYSTEM]) and follow these steps. Where [USER] is, use your IBM i user profile name.
> mkdir /home/[USER]
> cd /home/[USER]
> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/[USER]/.ssh/id_rsa):
Created directory '/home/[USER]/.ssh'.
Enter passphrase (empty for no passphrase): [ENTER]
Enter same passphrase again: [ENTER]
Your identification has been saved in /home/[USER]/.ssh/id_rsa.
Your public key has been saved in /home/[USER]/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:EjLLnXBpN/+TQ55RnOP1xjWfpf5qQYSPem9BsVYGxo4 [USER]@swagibmi
The key's randomart image is:
+---[RSA 2048]----+
| oo. |
| . .o+.o|
| + = o *=*+|
| . O + o EoB=B|
| o + S ..o+o.=|
| . .+.=o. |
| .B..o |
| o+. |
| o...|
+----[SHA256]-----+
So now we have an SSH key stored at /home/[USER]/.ssh/id_rsa.pub. We need to copy the contents of this file onto our GitHub account.
Select a repo you want to clone on GitHub. For this example, I will use DB2GET. To clone, you will need to close 'with SSH': open the repository on GItHub and click 'Clone or download'. Copy the SSH link that this window provides.
You may be presented with this, but just take the 'yes' option.
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Compiling RPG from the IFS
This piece is specific to DB2GET. Obviously each project is different!
Now you have a Git repo in your home directory, it's time to compile the program provided. To do this, I will use Rational Developer for i.
Open RDi and connect to your system. Browse down to your repo on the IFS.
Right click 'DB2GET.sqlrpgle', select Compile->CRTSQLRPGI and wait for the compile to happen.
Now the program is compiled and you can do what you want with it!
Making changes, committing and pushing
Next, you can open your editor and making changes to the IFS source. As you make changes, don't forget to compile and make sure your programs work before you commit anything. To save time, you can see what changes I made here:
Now, let's see what files have changed and commit the files. Back into your SSH session:
cd DB2GET to change directory into your local repo.
Use git status to see what files have changed.
> git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
modified: DB2GET.sqlrpgle
no changes added to commit (use "git add" and/or "git commit -a")
git add --all to add all modified files to the index before the commit. You can optionally use git status to see that the files have been added.
git commit -m "[COMMIT_MESSAGE]" to make a commit to the local repo, where [COMMIT_MESSAGE] is your commit message.
What you will need:
Setting up your SSH key
An SSH key is a passphrase. You generate it on your IBM i, then upload it to GitHub. Then whenever you interact with your remote repo, it authenticates by making sure these keys match. Do not share your key.
Start an SSH session (
ssh [USER]@[SYSTEM]
) and follow these steps. Where[USER]
is, use your IBM i user profile name.> mkdir /home/[USER]
> cd /home/[USER]
> ssh-keygen
So now we have an SSH key stored at
/home/[USER]/.ssh/id_rsa.pub
. We need to copy the contents of this file onto our GitHub account.Git user setup
You will need to setup your local Git profile to have a name and password. Simply use these commands, but replace the values in speech marks:
Cloning some RPG.
Select a repo you want to clone on GitHub. For this example, I will use DB2GET. To clone, you will need to close 'with SSH': open the repository on GItHub and click 'Clone or download'. Copy the SSH link that this window provides.
Use this link to close the repository, like so:
You may be presented with this, but just take the 'yes' option.
Compiling RPG from the IFS
This piece is specific to DB2GET. Obviously each project is different!
Now you have a Git repo in your home directory, it's time to compile the program provided. To do this, I will use Rational Developer for i.
Now the program is compiled and you can do what you want with it!
Making changes, committing and pushing
Next, you can open your editor and making changes to the IFS source. As you make changes, don't forget to compile and make sure your programs work before you commit anything. To save time, you can see what changes I made here:
Now, let's see what files have changed and commit the files. Back into your SSH session:
cd DB2GET
to change directory into your local repo.git status
to see what files have changed.git add --all
to add all modified files to the index before the commit. You can optionally usegit status
to see that the files have been added.git commit -m "[COMMIT_MESSAGE]"
to make a commit to the local repo, where[COMMIT_MESSAGE]
is your commit message.git push
to finish and push the code back up to the remote repository on GitHub.And that's it! You've now made a change, commit and push. You can see the change that I made for this example here.