DEV Community

Cover image for How to connect your android device to github using ssh key with termux
Umar Sulaiman Mailafiya
Umar Sulaiman Mailafiya

Posted on

How to connect your android device to github using ssh key with termux

Recently, I tried installing git and github on my phone. So that I can make changes on the go without being on my pc. I started by installing git. With git alone I thought I was already done. I went to my repo to get the link I want to clone. I ran the regular command as you know it git clone "link🔗". It prompted me with the username and password authentication prompt. Fast forward… with all the inputting and attempts to connect it to github, still no positive result. Then I discover I have to use shh in the connection as it appears to be the only way. I've searched for different ways to do it. From reading more than 7 blog articles to watching 2 YouTube Videos. Finally, I found the way ✨🎉.
In this post I'll tell you 5 simple steps I took to install git and connect it to github successfully and how you can too.

Step 1.

Download Termux using termux github build from
url(https://github.com/termux/termux-app/actions/runs/2518728695)
When you go to the page scroll down to find these builds and download the topmost.
Image description

Step 2.

Run apt update and apt upgrade In your termux terminal.

Step 3.

Run pkg install git
pkg install openssh
Image description
During the installation process you'll be prompted to create a username and password. You can choose to add or skip by pressing enter. But I'll recommend you skip, you can do that later.

Step 4.

When the ssh installation is done.
Run cat ./ .ssh/id_rsa.pub
Image description
You'll be presented with some text and your GitHub email address you added in the installation of the previous packages. Copy them all together. They're your public ssh key. If the email is not there, replace the email at the end with your GitHub account email address.

Step 5.

Next go to your GitHub account settings and click the ssh and gpg keys option.

Image description
Scroll down
Image description
Click on add new ssh key. Write a title for the key and paste the key in the provided box below the title.
Save.
Go back to your termux app and start using github as you would on desktop 🖥. You can test by cloning a repo.

Conclusion

Thank you so much. I hope this helps.

Discussion (0)