SSH and GIT on Android with Terminal IDE

I just discovered Terminal IDE, which is a nice package for Android containing a useful collection of tools like ssh, git, tmux, vim and more! However, I came up against a slight issue since I have configured my VPS to only use public key authentication for SSH. This also caused me some issues using GIT with it and with GitHub. Funnily enough I couldn’t find much information about it on google, particularly about using dropbear as an SSH client – I eventually stumbled on Using dropbear with git, which is useful after reading Using Public Keys with Dropbear SSH client. I’m going to briefly combine the two mini-tutorials into one place, more for my own sanity than anything else (and also to test my lovely syntax highlighter):

Create your key (assumes ~/.ssh exists, it did for me):

Convert the key to openssh format, outputting to the file my_key in the same directory:

At this point, you should probably copy up the contents of my_key to your server’s authorized_keys file (or add to your GitHub keys, for example).

Now we will create a simple shell script as per the first tutorial linked above, but we are going to amend it slightly – if you are using the Terminal IDE one of the benefits to users who haven’t rooted is that, well, they don’t have to root – so we’re going to create our script in ~/sssh instead of anywhere else:

Finally, we’re just going to change our GIT_SSH environment variable:

Now you should be good to go!