Go Back

POSTS

Installing and setting up git and GitHub on android

Termux

A quick tutorial on turning an Android phone into a portable coding terminal using Termux, Git, and the GitHub CLI to securely manage code and review pull requests on the go.

Author:

Llewellyn Paintsil

Published:

Read:

3 mins

Installing and setting up git and GitHub on android thumbnail

We have all been there. You’re away from your laptop, an urgent bug report comes in, or you just need to review and approve a quick pull request, but all you have is your smartphone.

The dreaded "I need my PC" excuse is a common hurdle for developers on the go. To get around it, some people turn to clunky web editors or sketchy third-party apps laden with pop-up ads. But trying to manage code through those workarounds is slow, frustrating, and often a usability nightmare.

There is a better way. Meet Termux, a powerful app that lets you run a native Linux environment right on your phone, allowing you to install Git and the GitHub CLI perfectly—without your code ever leaving your secure local setup.

What is this setup?

By combining Termux with the official GitHub CLI, you are essentially turning your Android device into a pocket-sized developer terminal. It is designed with a "no-compromises" philosophy: you install the standard tools, authenticate your account, and it handles the rest.

Because it runs natively on your phone's local storage, it is fast. Plus, since you aren't routing your repositories through a third-party service, your code and credentials remain 100% private.

Why You Should Use It

  • No Shady Workarounds: You avoid unofficial apps, shady websites, and annoying pop-up ads by using the same open-source tools you use on a desktop.
  • Familiarity: All the standard GitHub and Git commands will work just like they do when you are using your computer.
  • Speed: No waiting for clunky mobile web interfaces to load. Terminal commands execute instantly.
  • Portability: Push, pull, commit, and manage SSH keys directly from your pocket, anywhere you have an internet connection.

How to Install Git and GitHub CLI

To set this up, you will need four things: an Android phone, an internet connection, Termux, and a GitHub account. This might sound a bit technical, but the documentation below covers every single step.

Step 1: Install Termux via F-Droid First, you need the terminal engine that runs everything. You should get this from F-Droid to ensure you have the latest, working version.

  1. Download and install F-Droid from your mobile browser. (You will have to allow your browser to install apps from unknown sources).
  2. Open F-Droid, search for Termux, and hit install.
  3. Note for newer devices: If you are met with an "Unsafe app blocked" dialog by Google Play Protect, just click on More details and then Install anyway.

Android installation block

Step 2: Install and Configure Git Now, let's get the core version control system installed.

Open Termux and type the following command, then hit enter:

pkg install git

Once that finishes, you need to go through the Git first-time setup so your commits are attributed to you. Run these two commands (you can replace the name and email with your own):

git config --global user.name "your name"
git config --global user.email youremail@example.com

Step 3: Install the GitHub CLI Next, we need GitHub's official command-line tool to make secure authentication a breeze.

Run this command:

apt install gh

How to Authenticate and Connect

Once everything is installed, it is time to link your phone to your GitHub account securely using SSH.

  1. Start the Login Process: Run the following command in Termux:
    gh auth login
  2. Follow the Prompts: The terminal will ask you a series of questions. Use your keyboard to navigate:
    • Where do you use GitHub? Choose GitHub.com.
    • What is your preferred protocol? Select SSH.
    • Generate a new SSH key? Choose Yes.
    • Enter a passphrase: You can leave this empty and just press Enter (otherwise, you will have to type a password every single time you pull or push).
    • Title for your SSH key: Name it something recognizable, like "Android-Termux".
    • How would you like to authenticate? Select Login with a web browser.
  3. Authorize the Connection: The terminal will give you a one-time code. Copy it, then press Enter. Your phone's web browser will open. Paste the code into the GitHub page and authorize the connection.

gh auth in termux

And that is it! You are fully set up. Every git and gh command is now at your fingertips.

Disclaimer: This guide uses open-source software. Always ensure you are downloading F-Droid and Termux from their official repositories to keep your device secure.

Author

Llewellyn Paintsil profile pic, a member of L.A.P

Llewellyn Paintsil

Driven by a transformative moment that sparked a deep fascination with technology, I've been captivated by all its facets, particularly the visual aspects of software and video.

Latest Posts

Tutorial
Compress Videos using 8mb thumbnail

Compress Videos using 8mb

Getting errors when trying to send videos? Don't use sketchy online converters. This guide explains how to self-host 8mb.local to compress high-quality clips privately using your own GPU.

Author

Llewellyn Paintsil

Duration

2 mins

Tutorial
How to Fix Corrupted Video Files thumbnail

How to Fix Corrupted Video Files

Did your PC crash mid recording? Don't delete that corrupted file. This guide explains exactly how to restore broken recordings and fix audio sync issues using free tools like Untrunc and FFmpeg.

Author

Llewellyn Paintsil

Duration

5 mins

Tutorial
Read Every Manga (For Free) with Komikku thumbnail

Read Every Manga (For Free) with Komikku

Tired of reading manga on websites that drain your battery and spam you with ads? There’s a better way. Meet Komikku: the clean, ad-free, and open-source alternative that every manga fan needs. Here is exactly how to set it up and start reading in minutes.

Author

Llewellyn Paintsil

Duration

6 mins