Skip to main content

How to Use Git and GitHub in Termux — Complete Version Control Guide 2026



Termux · Git · GitHub · Android

How to Use Git and GitHub in Termux — Complete Version Control Guide on Android 2026

🆓 Free 🤖 No Root Required 📱 Android ✅ Tested 2026

// 01 — Introduction

If you've ever wanted to manage your code, collaborate on projects, or back up your work — all from your Android phone — then learning how to use Git and GitHub in Termux is one of the most powerful skills you can develop. In 2026, mobile development has exploded, and Termux has become the go-to Linux terminal emulator for Android users who want real development capabilities right in their pocket.

Git is the world's most popular version control system. It tracks every change you make to your code, lets you roll back mistakes, and enables seamless collaboration with other developers. GitHub, on the other hand, is the cloud platform where millions of developers store, share, and collaborate on their Git repositories. Together, Git and GitHub form the backbone of modern software development — and yes, you can use both of them fully from Termux on your Android device, no root required.

In this complete guide by Rixon Xavier, you'll learn everything from installing Git in Termux to cloning repositories, making commits, pushing code to GitHub, handling branches, and solving the most common errors that beginners face. Whether you're a student learning to code, a cybersecurity enthusiast managing your tools, or a developer who wants to work on the go, this tutorial has everything you need.

By the end of this post, you'll be able to use Git and GitHub in Termux just as comfortably as any desktop developer. Let's get started!

💡
Tip: All commands in this guide are tested on Termux in 2026. No root is required for any step in this tutorial.

// 02 — What is Git and Why Use It in Termux?

Before we dive into the installation and commands, it's important to understand what Git actually is and why using it inside Termux is such a powerful combination for Android users.

What is Git?

Git is a free, open-source distributed version control system created by Linus Torvalds in 2005 — the same person who created the Linux kernel. It was designed to handle everything from small to very large projects with speed and efficiency. Git tracks changes in your source code during software development and allows multiple developers to work on the same project simultaneously without overwriting each other's work.

At its core, Git works by taking "snapshots" of your files at different points in time. These snapshots are called commits. Every commit has a unique ID, a message describing the change, and a record of exactly what was modified. This means you can always go back to any previous version of your project if something goes wrong.

What is GitHub?

GitHub is a web-based hosting service for Git repositories. Think of it as a cloud storage platform specifically designed for code. GitHub provides a visual interface for your Git repositories, lets you collaborate with other developers, report issues, review code changes, and much more. It's owned by Microsoft and is used by over 100 million developers worldwide.

Why Use Git in Termux?

Termux gives you a full Linux environment on your Android phone. This means you can run the exact same Git commands that developers use on their laptops and desktops. Here's why this is incredibly useful:

Work anywhere: Your phone is always with you. With Git in Termux, you can commit code changes, pull updates, and push your work to GitHub from anywhere — on the bus, in a cafe, or during a break.

Manage cybersecurity tools: Many ethical hacking and cybersecurity tools are hosted on GitHub. With Git in Termux, you can clone these tools directly to your phone and keep them updated with a single command.

Learn real development skills: Using Git from the command line teaches you how it actually works under the hood — something that GUI tools hide from you. This makes you a better and more confident developer.

Backup your scripts: If you write Termux scripts, automation tools, or configurations, Git lets you back them up to GitHub and access them from any device.

Git works 100% in Termux without root. You get the full Git experience — branches, commits, push, pull, merge — all from your Android phone.

// 03 — Installing Git in Termux

Installing Git in Termux is straightforward and takes less than a minute. Follow these steps carefully.

Step 1 — Update Termux Packages

Before installing anything, always update your package list to make sure you're getting the latest version of Git. Open Termux and run:

bash copy
pkg update && pkg upgrade -y

This command updates all your existing packages and ensures your system is ready. It may take a minute or two depending on your internet connection.

01

Update Package List

Always run pkg update before installing new packages to avoid version conflicts.

Step 2 — Install Git

Now install Git using Termux's package manager:

bash copy
pkg install git -y
02

Install Git Package

The -y flag automatically confirms the installation without asking you to type "yes".

Step 3 — Verify Installation

After installation completes, verify that Git was installed correctly by checking its version:

bash copy
git --version

You should see output like this:

output copy
git version 2.43.0
03

Verify Git Version

If you see a version number, Git is installed and ready to use in Termux.

Git is now installed in Termux! The installation is complete and you're ready to configure it.

// 04 — Configuring Git and Connecting to GitHub

After installing Git, you need to configure it with your identity and connect it to your GitHub account. This is a one-time setup that Git uses to sign your commits.

Set Your Username and Email

Git needs to know who you are so it can attach your name and email to every commit you make. Run these two commands, replacing the values with your own information:

bash copy
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
💡
Tip: Use the same email address that you use for your GitHub account. This links your commits to your GitHub profile.

Set Default Branch Name

GitHub uses main as the default branch name. Set Git to use the same:

bash copy
git config --global init.defaultBranch main

Verify Your Configuration

Check that your configuration was saved correctly:

bash copy
git config --list

Connecting to GitHub — Personal Access Token (PAT)

GitHub no longer accepts passwords for Git operations over HTTPS. Instead, you need a Personal Access Token (PAT). Here's how to get one:

01

Go to GitHub Settings

Open github.com → Click your profile picture → Settings → Developer Settings → Personal Access Tokens → Tokens (classic) → Generate new token

02

Set Token Permissions

Give it a name like "Termux", set expiration, and check the repo scope for full repository access. Click Generate token.

03

Save Your Token

Copy the token immediately — GitHub only shows it once! Save it somewhere safe. You'll use this as your password in Termux.

Save Credentials in Termux

To avoid typing your token every time, store your credentials:

bash copy
git config --global credential.helper store

The first time you push or pull, Git will ask for your GitHub username and token. After that, it remembers them automatically.

⚠️
Warning: The credential store saves your token in plain text. On a shared device, consider using SSH keys instead for better security.

Alternative — SSH Key Authentication

For better security, you can use SSH keys instead of a token. Generate an SSH key in Termux:

bash copy
pkg install openssh -y
ssh-keygen -t ed25519 -C "your@email.com"
cat ~/.ssh/id_ed25519.pub

Copy the output and add it to GitHub → Settings → SSH and GPG keys → New SSH key. Now you can use SSH URLs when cloning repositories.

// 05 — Essential Git Commands in Termux

Now that Git is installed and configured, let's learn the most important Git commands you'll use every day. Understanding these commands is the foundation of using Git in Termux effectively.

Initialize a Repository

To start tracking a project with Git, navigate to your project folder and initialize a Git repository:

bash copy
mkdir myproject
cd myproject
git init

This creates a hidden .git folder inside your project directory that stores all version history.

Check Repository Status

This is one of the most used Git commands. It shows you which files are modified, staged, or untracked:

bash copy
git status

Stage Files for Commit

Before committing, you need to "stage" the files you want to include. Staging lets you choose exactly which changes to include in a commit:

bash copy
# Stage a specific file
git add filename.py

# Stage all changed files
git add .

# Stage all files of a specific type
git add *.py

Commit Your Changes

A commit is a snapshot of your staged files. Always write a clear, descriptive commit message:

bash copy
git commit -m "Add login feature"
💡
Tip: Write commit messages in present tense. "Add feature" not "Added feature". This is the industry standard and makes your history cleaner.

View Commit History

See all past commits in your repository:

bash copy
# Full log
git log

# Compact one-line log
git log --oneline

# Visual branch graph
git log --oneline --graph --all

Working with Branches

Branches let you work on new features without affecting the main codebase. This is essential for team collaboration and safe experimentation:

bash copy
# List all branches
git branch

# Create a new branch
git branch feature-login

# Switch to a branch
git checkout feature-login

# Create and switch in one command
git checkout -b feature-login

# Merge a branch into main
git checkout main
git merge feature-login

# Delete a branch after merging
git branch -d feature-login

Undo Changes

One of Git's most powerful features is the ability to undo mistakes:

bash copy
# Unstage a file (keep changes)
git restore --staged filename.py

# Discard changes in working directory
git restore filename.py

# Undo last commit (keep changes staged)
git reset --soft HEAD~1

# Undo last commit (discard changes)
git reset --hard HEAD~1
⚠️
Warning: git reset --hard permanently deletes your uncommitted changes. Use with caution!

// 06 — Working with Repositories — Clone, Push, Pull

The real power of using GitHub with Termux comes from syncing your local work with remote repositories. These three operations — clone, push, and pull — are the foundation of collaborative development.

Clone a Repository

Cloning downloads a complete copy of a remote repository to your Termux environment. This is how you get tools, projects, and code from GitHub:

bash copy
# Clone via HTTPS
git clone https://github.com/username/repository.git

# Clone via SSH
git clone git@github.com:username/repository.git

# Clone into a specific folder
git clone https://github.com/username/repo.git myfolder

# Clone only the latest commit (faster for large repos)
git clone --depth 1 https://github.com/username/repo.git
💡
Tip: Use --depth 1 when cloning large cybersecurity tools in Termux. It downloads only the latest version and saves storage space on your phone.

Add a Remote Repository

If you initialized a local repository and want to connect it to GitHub, first create a new repository on GitHub (without README), then link it:

bash copy
# Add remote origin
git remote add origin https://github.com/username/repo.git

# Verify remote was added
git remote -v

# Change remote URL
git remote set-url origin https://github.com/username/newrepo.git

Push Your Code to GitHub

Pushing uploads your local commits to the remote GitHub repository:

bash copy
# Push to main branch (first time)
git push -u origin main

# Push after first time
git push

# Push a specific branch
git push origin feature-login

# Force push (use carefully!)
git push --force

Pull Updates from GitHub

Pulling downloads the latest changes from the remote repository and merges them into your local branch:

bash copy
# Pull latest changes
git pull

# Pull from specific branch
git pull origin main

# Fetch without merging (safer)
git fetch origin
git diff origin/main

Fork and Contribute to Open Source

Want to contribute to an open source project? Here's the workflow using Git in Termux:

01

Fork the Repository

Go to the GitHub repository and click Fork. This creates your own copy.

02

Clone Your Fork

Run: git clone https://github.com/yourusername/repo.git

03

Create a Branch and Make Changes

Run: git checkout -b fix-bug then make your edits.

04

Push and Create Pull Request

Run: git push origin fix-bug then go to GitHub and open a Pull Request.

// 07 — Common Errors and Fixes

Error: "Permission denied (publickey)"

error copy
Permission denied (publickey).

Fix: You're using SSH but haven't added your SSH key to GitHub. Either switch to HTTPS or add your public key to GitHub Settings → SSH Keys.

Error: "remote: Support for password authentication was removed"

error copy
remote: Support for password authentication was removed on August 13, 2021.

Fix: Use a Personal Access Token instead of your GitHub password. Generate one at GitHub → Settings → Developer Settings → Personal Access Tokens.

Error: "fatal: not a git repository"

error copy
fatal: not a git repository (or any of the parent directories): .git

Fix: You're running a Git command outside a repository. Either run git init or navigate into a cloned repository folder.

Error: "CONFLICT — Merge conflict"

Fix: Open the conflicting file and look for conflict markers:

bash copy
# View conflicting files
git status

# Edit the file in nano and resolve conflicts manually
nano conflicted_file.py

# After fixing, stage and commit
git add .
git commit -m "Resolve merge conflict"

Error: "Updates were rejected"

error copy
! [rejected] main -> main (fetch first)

Fix: Pull the latest changes first, then push:

bash copy
git pull origin main --rebase
git push origin main

// 08 — Pro Tips for Git in Termux

💡
Tip 1 — Use .gitignore: Create a .gitignore file to exclude files you don't want tracked (like API keys, passwords, or large files). Run: echo "*.env" >> .gitignore
💡
Tip 2 — Git Aliases: Create shortcuts for long commands. Example: git config --global alias.st status lets you type git st instead of git status.
💡
Tip 3 — Stash Your Work: If you need to switch branches but aren't ready to commit, use git stash to temporarily save your changes and git stash pop to restore them.
💡
Tip 4 — Use GitHub CLI: Install GitHub's CLI tool in Termux with pkg install gh for even more powerful GitHub operations directly from the terminal.
💡
Tip 5 — Keep Tools Updated: For cloned cybersecurity tools, run git pull regularly to keep them updated with the latest fixes and features from the developer.

// 09 — Git vs GitHub — Key Differences

Feature Git GitHub
Type Software / Tool Cloud Platform / Website
Works Offline ✅ Yes ❌ No
Installation Installed in Termux Account on github.com
Storage Local device Cloud (remote)
Collaboration Limited ✅ Full team features
Cost Free Free (with paid plans)
Required ✅ Yes (core tool) Optional (but recommended)
Purpose Version control Hosting + Collaboration

// 10 — Frequently Asked Questions

Can I use Git in Termux without root?
Yes, absolutely! Git works perfectly in Termux without any root access. This is one of the biggest advantages of using Termux — you get a full Linux development environment on your Android phone without needing to root your device.
How do I save my GitHub password in Termux so I don't have to type it every time?
Run git config --global credential.helper store. The first time you authenticate, Git will save your credentials. From then on, you won't need to enter your username and token again. Alternatively, set up SSH key authentication for a more secure approach.
What is the difference between git fetch and git pull?
git fetch downloads changes from the remote but does NOT merge them into your local branch. It lets you review changes before applying them. git pull downloads AND merges in one step. For beginners, git pull is simpler. For careful work, use git fetch followed by git merge.
How do I clone a private GitHub repository in Termux?
Use HTTPS with your Personal Access Token: git clone https://YOUR_TOKEN@github.com/username/private-repo.git. Or set up SSH authentication and use the SSH clone URL. Make sure your token has the repo scope enabled.
Can I use Git in Termux to install hacking tools from GitHub?
Yes! Many cybersecurity and ethical hacking tools are hosted on GitHub. You can clone them directly with git clone. Always use tools only on systems you own or have explicit permission to test. Visit hydratermux.blogspot.com for tutorials on specific tools.
How do I update a tool I cloned from GitHub?
Navigate into the tool's folder and run git pull. This downloads and applies the latest updates from the developer. It's much better than deleting and re-cloning because it only downloads what changed.

// 11 — Conclusion

You've now learned everything you need to use Git and GitHub in Termux like a pro. From installing Git and configuring your identity, to cloning repositories, making commits, pushing code to GitHub, working with branches, and fixing common errors — you have a complete toolkit for version control on Android.

Git is not just for professional developers. Whether you're a student learning to code, a cybersecurity enthusiast managing your tools, or someone who just wants to back up their scripts — Git in Termux gives you real, professional-grade version control right in your pocket. No root required, no expensive laptop needed.

The best way to get comfortable with Git is to practice. Create a test repository, make some changes, commit them, push to GitHub, and experiment with branches. The more you use it, the more natural it becomes. Before long, git add, git commit, and git push will feel as natural as typing any other command.

If you found this guide helpful, share it with your friends who use Termux and subscribe to HYDRA TERMUX for more free tutorials on Termux tools, Linux commands, and ethical cybersecurity. Drop a comment below if you have any questions — we read every single one!

You're now ready to use Git and GitHub in Termux! Start by creating your first repository and making your first commit today.

Rixon Xavier

Founder — HYDRA TERMUX

Cybersecurity educator and Termux enthusiast. Creating free tutorials to help Android users learn Linux and ethical cybersecurity since 2023.

⚠️ Disclaimer: This tutorial is for educational purposes only. Always practice on systems you own or have explicit permission to test. HYDRA TERMUX does not support illegal activity of any kind.
--- BLOGGER SETTINGS FOR THIS POST: Title: How to Use Git and GitHub in Termux — Complete Version Control Guide 2026 Labels: termux, linux, android, git, github tools, Termux Tutorial, coding, Hydra Termux Search Description: Learn how to install and use Git and GitHub in Termux on Android. Complete 2026 guide — no root required. Clone, push, pull and more! Custom Robot Tags: all, noodp ---

Comments

Popular posts from this blog

How to Install Ubuntu in Termux Using GitHub — Complete Step-by-Step Guide for Android (2026)

Termux · Ubuntu · Linux on Android How to Install Ubuntu in Termux Using GitHub — Complete Step-by-Step Guide for Android (2026) 📅 February 28, 2026 👤 Rixon Xavier ⏱ 15 min read 📝 4,000+ words 🆓 Free 🤖 No Root Required 📱 Android 7.0+ ✅ Tested 2026 // Table of Contents Introduction — Why Run Ubuntu on Android? What Is Termux and How Does It Work? What Is Ubuntu and Why Use It in Termux? How Ubuntu Actually Runs Inside Termux Requirements Before You Begin Step 1 — Update and Upgrade Termux Packages Step 2 — Install Git Step 3 — Clone the Ubuntu Script from GitHub Step 4 — Navigate to the Cloned Directory Step 5 — Grant Execute Permission to the Script Step 6 — Run the Installation Script Step 7 — Launch Ubuntu Step 8 — Verify the Installation Step 9 — Upda...

How to Use Vim and Nano Text Editors in Termux — Complete Guide (2026)

Termux · Linux · Android How to Use Vim and Nano Text Editors in Termux — Complete Guide 📅 March 04, 2026 👤 Rixon Xavier ⏱ 14 min read 📝 3,500+ words 🆓 Free 🤖 No Root Required 📱 Android ✅ Tested 2026 // Table of Contents Introduction Installing Vim and Nano in Termux Getting Started with Nano Getting Started with Vim Advanced Tips for Both Editors Common Errors and Fixes Pro Tips Vim vs Nano — Comparison Table FAQ Conclusion // 01 — Introduction If you spend any real time in Termux, you will eventually need a text editor. Whether you are writing a Python script, editing a config file, or building something from scratch, having a solid text editor right inside your terminal makes everything faster and smoother. That is exactly where Vim and Nano in Termux come in — two of the most ...

What is Fish Shell & How to Install It in Termux (2026 Complete Guide)

Termux · Linux · Android What is Fish Shell & How to Install It in Termux (2026 Complete Guide) 📅 February 25, 2026 👤 Rixon Xavier ⏱ 14 min read 📝 3,500+ words 🆓 Free 🤖 No Root Required 📱 Android ✅ Tested 2026 // Table of Contents Introduction — Why Fish Shell Matters What is Fish Shell? A Deep Dive Fish Shell vs Bash vs Zsh — Key Differences How to Install Fish Shell in Termux Configuring and Customizing Fish Shell Essential Fish Shell Commands and Features Common Errors and Fixes Pro Tips for Fish Shell in Termux Comparison Table — Bash vs Zsh vs Fish FAQ Conclusion // 00 — Introduction: Why Fish Shell Matters in Termux If you have been using Termux for a while, you already know that the default shell is bash . It works, it gets the job done, and millions of Linux users rely on...

TubeGrab — A Free Open-Source Termux Tool by HYDRA TERMUX (2026)

Termux · Android · Tools TubeGrab — Download YouTube Videos & MP3 in Termux (4K/8K) Free 2026 📅 February 19, 2026 👤 Rixon Xavier ⏱ 8 min read 📝 2,500+ words 🆓 Free 🤖 No Root Required 📱 Android ✅ Tested 2026 // Table of Contents What is TubeGrab? Key Features Requirements Installation — 4 Methods How to Use TubeGrab Video & MP3 Quality Options Troubleshooting Common Errors FAQ Conclusion // 01 — What is TubeGrab? TubeGrab is a free, open-source Bash script built specifically for Termux on Android that lets you download YouTube videos and MP3 audio in any quality — all from your phone's terminal, with no root required. If you have been looking for a reliable YouTube downloader for Termux in 2026, TubeGrab is the cleanest solution available. Created by HYDRA-TERMUX and powe...

How to Install and Use Zsh with Oh-My-Zsh in Termux (2026)

Termux · Linux Customization · Android How to Install and Use Zsh with Oh-My-Zsh in Termux (2026) 📅 March 3, 2026 👤 Rixon Xavier ⏱ 18 min read 📝 3,800+ words 🆓 Free 🤖 No Root Required 📱 Android ✅ Tested 2026 // Table of Contents Introduction What is Zsh and Why Use It in Termux? Prerequisites: Prepare Your Termux Step-by-Step: Install Zsh in Termux Install and Configure Oh-My-Zsh Essential Plugins for Termux Users Customize Zsh with Themes Common Errors and Fixes Pro Tips for Zsh Power Users Zsh vs Bash in Termux FAQ Conclusion // 01 — Introduction: Why Your Termux Needs Zsh If you have been using Termux for any serious work—whether it's ethical hacking practice, Python development, or just exploring Linux on your Android—you have probably spent countless hours staring at the default Bash prompt. It works, but it's boring, limited, and slow. In 2026, there is no reason to stick with a basic shell when you can install Zsh with Oh-My-Zs...

How to Use tmux in Termux — Run Multiple Sessions on Android (2026 Guide)

Termux · Ethical Hacking · Android How to Use tmux in Termux — Run Multiple Sessions on Android (2026 Guide) 📅 March 02, 2026 👤 Rixon Xavier ⏱ 18 min read 📝 3,500+ words 🆓 Free 🤖 No Root Required 📱 Android ✅ Tested 2026 // Table of Contents Introduction — Why tmux Changes Everything in Termux What Is tmux and How Does It Work? How to Install tmux in Termux Core tmux Commands — Sessions, Windows, and Panes Advanced tmux Usage — Scripting and Config Real-World Use Cases for tmux in Termux Common Errors and Fixes Pro Tips for Power Users tmux vs Screen — Full Comparison Frequently Asked Questions Conclusion // 01 — Introduction — Why tmux Changes Everything in Termux If you have been using tmux in Termux for a while, you already know how limiting a single terminal window can f...

How Cybersecurity Professionals Test Network Security — Complete Guide for Beginners (2026)

Termux · Cybersecurity · Network Security · Android How Cybersecurity Professionals Test Network Security — Complete Guide for Beginners (2026) 📅 February 28, 2026 👤 Rixon Xavier ⏱ 15 min read 📝 3,500+ words 🆓 Free 🎓 Educational 📱 Android ✅ Beginner Friendly // Table of Contents Introduction — What Is Network Security Testing? Why Network Security Testing Matters in 2026 Types of Security Testing Professionals Do The Step-by-Step Methodology Professionals Follow Essential Tools Used in Network Security Testing Why Termux Is a Legitimate Learning Platform Setting Up Your Learning Environment in Termux Step 1 — Update and Prepare Termux Step 2 — Install Core Networking Tools Step 3 — Using the Metahack Security Framework Understanding the Framework Menu Options ...

Termux Shortcuts & Tips Nobody Tells You About (2026)

Termux Shortcuts & Tips Nobody Tells You About (2026) — HYDRA TERMUX HYDRA TERMUX 2026 Termux Secrets Shortcuts & Tips Nobody Tells You Android Linux  ·  Terminal Mastery  ·  2026 $ termux-wake-lock $ alias cls='clear' $ sshd --port 8022 $ source ~/.bashrc Termux Tutorial · Android Linux · 2026 Termux Shortcuts & Tips Nobody Tells You About HYDRA TERMUX Feb 22, 2026 9 min read Beginner – Intermediate You installed Termux. You ran pkg update . You followed a few tutorials. And now you are still typing everything the long way, losing sessions you spent time on, fighting a phone keyboard that has no Escape key, and wondering why your scripts randomly die in the background. Nobody covered any of that. This post does. Every Termux tutorial shows you the same three things — install Python, ...

How to Install Kali Linux in Termux (No Root) 2026 – HYDRA TERMUX

Termux · Kali Linux · Android How to Install Kali Linux in Termux Without Root — Complete 2026 Guide 📅 February 22, 2026 👤 Rixon Xavier ⏱ 15 min read 📝 3,500+ words 🆓 Free 🤖 No Root Required 📱 Android 7.0+ ✅ Tested 2026 // Table of Contents Introduction — What We Are Actually Doing Here Why Install Kali Linux in Termux? Requirements Before You Start Step 1 — Get the Right Version of Termux Step 2 — Update Termux Packages Step 3 — Install the Required Tools Step 4 — Download the NetHunter Installer Step 5 — Run the Installer Step 6 — Launch Kali Linux on Your Phone Step 7 — Update Kali and Install Tools Step 8 — Set Up the Kali GUI Desktop (Optional) Troubleshooting Common Errors Pro Tips FAQ Conclusion // 01 — Introduction: What We Are Actually Doing He...