Configure GitHub on Termux

A brief howto connect to GitHub using git on Termux

Install Termux

Install termux via the f-droid store, the Google Play store has a version of Termux too, but that one is outdated, use f-droid or the github repository releases to install the latest version.

Install Git and openssh

  1. Run the following command to update and upgrade all existing software:
apt update && apt upgrade
  1. Install git and openssh
apt install git openssh

Give Termux access to the local storage

You’ll probably want Termux to have access to the storage of your android device, in order to do that simply use the following command:

termux-setup-storage

Generate an ssh key

Generate the ssh key with the following command:

ssh-keygen -t rsa -C "EMAIL"

Where the EMAIL is the email associated with your github user account.

I had to leave everything blank, don’t provide a keyfile name and don’t provide a passphrase. This may not be strictly necessary, but it failed to use the file correctly when I gave it a specific name.

Upload your ssh key on GitHub.com

  1. Get the content of your public key with this command, and copy the output:
cat ~/.ssh/id_rsa.pub
  1. Login to GitHub and go to Settings > SSH and GPG Keys and add a new SSH key as an Authentication key with the content of your public ssh key.

Authenticating with GitHub

Login to GitHub using your ssh key with this command:

ssh -T git@github.com

Or if you want a more verbose output to see any potential errors use this one instead:

ssh -vT git@github.com

Fix ‘GitHub does not provide shell access’

I kept getting this error:

Hi USER! You've successfully authenticated, but GitHub does not provide shell access.

An was not able to successfully execute any git commands, either getting that error above or being asked to preform a, deprecated, password authentication that would naturally fail.

In order to fix this you have to force it to use an SSH connection for github rather than a standard https one that it seems to insist on using.

Add this to the ~/.gitconfig file to use ssh instead of https for github.

[url "ssh://git@github.com/"]
        insteadOf = https://github.com/