Link Termux To Your Github Account On Android Using Ssh Keys ๐Ÿ”

Link Termux To Your Github Account On Android Using Ssh Keys ๐Ÿ”

ยท

3 min read

Do you know there is a way to build a full project with your android ??. Here, termux works as the command line interface and, there are several IDEs(Integrated Development Environments) on androids such as Acode, Spck editor, Code editor, etc.

Note: Avoid downloading termux on play store, download it on Fdroid, click here to set up termux and install git

Now, let's take a cup of coffee โ˜• and get to work

Firstly, let's discuss how to generate ssh keys from termux.

  1. Install the openssh package in Termux by running pkg install openssh

  2. Once the installation is complete, generate a new SSH key by running

    ssh-keygen -t ed25519 -C your_email

    Replace your_email with your Gmail account associated with GitHub

  3. The ssh-keygen command will prompt you to enter a file name for the key pair. You can leave the default value by pressing Enter.

  4. You will then be prompted to enter a passphrase. You can leave this blank if you don't want to use a passphrase, or enter a passphrase if you want to add an extra layer of security.

  5. Once the key pair is generated, you can view the public key by running cat ~/.ssh/id_ed25519.pub

  6. Copy the output of the command and add it to your GitHub account. You can follow the steps here.

Now let's integrate termux into the GitHub account

  1. Open the terminal in Termux and run eval $(ssh-agent -s) to start the SSH agent

  2. Add your private SSH key to the SSH agent by running ssh-add ~/.ssh/id_ed25519

    If you used a different file name for your SSH key, replace id_ed25519 with the appropriate file name.

  3. To verify that the SSH key has been added to the SSH agent, run ssh-add -l. You should see the fingerprint of your SSH key listed.

  4. Finally, you can connect to your GitHub account by running `ssh -T git@github.com`

    The first time you connect to GitHub, you may see a message asking you to confirm the authenticity of the host. Type yes to confirm.

  5. If everything is set up correctly, you should see a message that says "Hi {your GitHub username}! You've successfully authenticated, but GitHub does not provide shell access."

    You can now use Git commands to clone, push and pull code to and from your GitHub account using the SSH protocol in Termux

Cloning a repository using the SSH URL is a storm in a teacup:

  • run git clone ssh_url_of_your_repo

  • The ssh_url_of_your_repo should be replaced by the SSH URL of your repository. Here is a way to get the SSH URL of your repository

You are good to go. You can now use your android to write codes freely and push them to GitHub.

Thanks for reading patiently. For more of this, follow me on Twitter. ๐Ÿ‘‹๐Ÿ‘‹

ย