Git for Termux

Git for Termux

Install git and gh on your termux.

Holla 🤠 my Friend, let me first introduce myself my name Jyotirmoy barman a tech nerd from the west part of India 🇮🇳 (Meghalaya). In this article, I am going to tell about git and how to install it in termux, as I know many beginners may be using the phone to do some light development or don't have money to buy a laptop.

Do follow me on Twitter to get all the latest updates @jyotirmoydotdev


As the internet says git is a version control to track the code changes and there is not any second thought. I am not going to explain it in detail, If you want to read more about it you can go to Wikipedia.


Installation of Termux on a phone is simple, just follow these steps.

step 1

If you want to install git on your phone then you must install the termux app first. As the termux app updated version is not available in play you must use the third party website to install it.

There are two places from where we can download the latest version of Termux.

F-droid : Termux
Github : Termux

step 2

After you have successfully installed termux on your phone, now you need to run some commands to update the packages and install git.

  • First, update the packages, this will update all the packages in Termux pkg update && pkg upgrade

  • Run this command to install git in termux
    pkg install git

  • I also recommend to install gh, it is a command line tool by github.
    pkg install gh

Recently Github announced that it will no longer accept account passwords when authenticating Git operations, that's why we need gh (Github command-line tool) to push our code in Github.

What is Github?

Github is a code hosting platform, owned by Microsoft.
For more information visit Github-wikipedia
Follow me on Github @jyotirmoydotdev


Till now you must install git and gh in termux, now it's time to learn it. First of all, we need to set up our git and gh to work flawlessly

write the following command to set up.

  • gh auth login Login to your Github account.
  • After you log in to your Github account, now setup your git
  • git config --global "name"
  • git config --global "email"
  • Now you are all set

Make Repository

If you want to track a folder you need need to init a folder. I recommended you first go to your Github account and make a repository. Screenshot 2022-01-26 at 9.29.30 PM.jpg

After that clone it in your local environment git clone "repository link"


run this code
gh create repo create and follow the command.

Push and Pull

After you have written some code in your repository and wish to upload it to your GitHub account then run this command.

  • git add . this will add all the code or if you want to upload a single file
    git add "file name"
  • git commit -m "Message" write what you have done in "Message"
  • git push this will upload all the code.

If you have done any change in your repository from Github or any other local machine and push it to your repository, then you can run

  • git pull

this will pull all the latest code and keep you up-to-date.

Command table

Here are the commands and their action for git and gh.

  • git --help
  • gh --help
git --versionto see what version of git you are using
git clone to clone the repository in the local environment
git add .to add all the files
git commit -m “message”to commit with message
git commit -m “title” -m “description”to commit with message and description
git pushto push code to the origine
git pullto pull the code from the online repo.
git config --global "name"to set the name
git config --global "email"to set email
git branch --listto see what branch we have
git branch to create branch
git branch -d safe branch delete
git branch -D Force delete
git branch -m merge branch
git statusTo see the changes
git switch to change existing branch
git switch -c to change to new branch
git logShow commit logs
gh auth loginto login in Github
git auth logoutLog out of a GitHub host
git auth statusView authentication status
Install gitbrew install git
Install ghbrew install gh


Thanks for reading this far, don't forget to follow in Twitter - @jyotirmoydotdev and Github - @jyotirmoydotdev.

I am always open to your suggestion 😄

Did you find this article valuable?

Support Jyotirmoy Barman by becoming a sponsor. Any amount is appreciated!