Prototype: Git

There may be times when you demand to work with Git, and the only device you accept is your Android smartphone. When that's the case, what do y'all practise? Thanks to a handy tool called Termux, it is possible to install the command line Git tool on a mobile device.

I'k going to walk you through the procedure of getting this upwardly and running. I'll demonstrate on Android ix, running on an Essential PH-one.

Once installed, you'll accept the full complement of tools found in the command line version of Git.

SEE: VPN usage policy (TechRepublic Premium)

What yous demand

The but things you lot demand are a device running version v.0 or newer of the Android platform and a GitHub business relationship. That'south information technology.

Permit'southward make this happen.

Installing Termux

The showtime matter to practise is install Termux. This is done from the Google Play Store, past following these steps:

  1. Open the Google Play Shop on your Android device.
  2. Search for Termux.
  3. Locate and tap the entry past Fredrik Fornwall.
  4. Tap Install.
  5. Let the installation to complete.

Once installed, you'll find a launcher for Termux on your home screen and/or your App Drawer. Locate that launcher and open the app. When the app opens, you should come across a somewhat familiar terminal window (Figure A)

Installing Git and SSH

Earlier y'all can run the installation command, you need to update and upgrade. To do that, outcome the control (Figure B):

apt update && apt upgrade

When the upgrade completes, you are ready to install both Git and SSH. To exercise that, issue the command:

apt install git openssh

This command (Figure C) will install both necessary apps.

Set upwards Git storage

Information technology's now fourth dimension to set Termux Storage. This is done with the command (from the Termux terminal):

termux-setup-storage

Upon running that command, you will be prompted to permit the app access to storage. Do then, and yous're ready for Git.

Connecting to GitHub

This is where it gets slightly tricky. From the Termux last, you must first create an ssh keypair. To do this, issue the control:

ssh-keygen -t rsa -C "Email"

Where EMAIL is your email address associated with your GitHub account.

Once yous generate the key, I suggest you lot use the scp command to copy it to a desktop computer. So change into the .ssh directory (on Termux) with the command:

cd .ssh

From inside that directory, issue the command:

scp id_rsa.pub USER@IP:/home/USER/

Where USER is a remote username and IP is the remote address of a desktop on the aforementioned network as your Android device (that accepts SSH connections).

Once yous have that file stored on a remote desktop, yous demand to log into GitHub (from the desktop now housing the .pub file) and go to Settings | SSH Keys. Re-create that id_rsa.pub cardinal into Git and salve it.

Logging into Git

Now that you copied your SSH public key to GitHub, y'all can log into your GitHub account with the control:

ssh -T git@github.com

Once yous authenticated, you are ready to start working with Git from your Android device. Create repositories, button, pull, and more. You might desire to too do yourself a favor and install the nano editor, via Termux (with the command apt install nano), and then you can actually edit lawmaking.

And in that location you go. A handy way to piece of work with Git on your Android device. Now … git to work.