DEV Community

Brajesh
Brajesh

Posted on

Gemini CLI + Termux + Notifications + GitHub = You Just Hired an AI Developer

One prompt. Zero babysitting. Full GitHub integration, smart notifications, and an agent that works while you're away.


What You'll Have After This

  • ✅ Gemini CLI running natively on Android via Termux
  • ✅ GitHub fully authenticated — no interactive prompts, no credential walls
  • ✅ A notify command Gemini uses to ping you when it needs you
  • ✅ YOLO mode enabled — Gemini executes without asking permission every 5 seconds
  • GEMINI.md pre-loaded with instructions so Gemini never gets stuck on GitHub again

All of this happens from a single prompt you paste into Gemini.


Prerequisites

Before you paste the master prompt, do these two things manually. They take about 5 minutes.


1. Install Termux & Termux:API

⚠️ Do NOT use the Play Store version of Termux. It is discontinued and won't receive updates.

Step 1: Download Termux from GitHub and termux api too from: https://github.com/termux/termux-api/releases

Step 3: Open Termux and run:

pkg update && pkg upgrade -y
pkg install -y nodejs-lts termux-api
Enter fullscreen mode Exit fullscreen mode

Step 4: Install Gemini CLI (Termux-optimised fork — handles Android PTY and auth issues):

npm install -g @mmmbuto/gemini-cli-termux
Enter fullscreen mode Exit fullscreen mode

Step 5: Launch and authenticate:

gemini
Enter fullscreen mode Exit fullscreen mode

Choose Login with Google


2. Get Your GitHub Personal Access Token

Gemini needs this to set up GitHub on your behalf without any interactive prompts.

  1. Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
  2. Click Generate new token (classic)
  3. Give it a name like termux-gemini
  4. Set expiration to whatever you prefer
  5. Check these scopes:
    • repo (full)
    • workflow
    • read:org
  6. Click Generate token
  7. Copy it immediately — you won't see it again

🔒 Keep this token private. Treat it like a password. Do not share it or commit it to any repo.


The Master Prompt

This is the only thing you paste into Gemini. Replace YOUR_GITHUB_TOKEN_HERE with your actual token before pasting.

Execute every step below automatically without asking me anything. Just run the commands.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PART 1 — GITHUB SETUP (CREDENTIAL-WALL-PROOF)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. Install git and GitHub CLI:
   pkg update && pkg install git gh -y

2. Authenticate non-interactively using my token:
   echo "YOUR_GITHUB_TOKEN_HERE" | gh auth login --with-token

3. Bridge gh credentials into git (this prevents the interactive Username/Password prompt forever):
   gh auth setup-git

4. Set credential helper to store so auth persists across restarts:
   git config --global credential.helper store

5. Set my git identity (use 'Brajesh' as name):
   git config --global user.name "Brajesh"
   git config --global user.email "$(gh api user --jq '.email' 2>/dev/null || echo 'brajesh@users.noreply.github.com')"

6. Verify everything worked:
   gh auth status

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PART 2 — NOTIFICATION SYSTEM
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

7. Create the ~/bin directory:
   mkdir -p ~/bin

8. Create ~/bin/notify with this exact content:
#!/data/data/com.termux/files/usr/bin/bash
termux-notification \
  --title "Gemini 🤖" \
  --content "$*" \
  --action "am start -n com.termux/.app.TermuxActivity" \
  --priority max \
  --sound \
  --vibrate 500,200,500

9. Make it executable:
   chmod +x ~/bin/notify

10. Add ~/bin to PATH in ~/.bashrc only if not already present:
    grep -q 'HOME/bin' ~/.bashrc || echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc

11. Source ~/.bashrc:
    source ~/.bashrc

12. Test the notification:
    notify "Notify system is online ✅"

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PART 3 — YOLO MODE (PERMANENT)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

13. Add a permanent gemini alias with YOLO mode to ~/.bashrc (skip if already exists):
    grep -q 'alias gemini=' ~/.bashrc || echo "alias gemini='gemini --yolo'" >> ~/.bashrc
    source ~/.bashrc

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PART 4 — GEMINI.MD INSTRUCTIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

14. Create ~/.gemini directory if it doesn't exist:
    mkdir -p ~/.gemini

15. APPEND the following to ~/.gemini/GEMINI.md (do NOT overwrite existing content):

## Git & GitHub Workflow

MANDATORY: These rules apply to every session. Never skip them.

### Setup Verification
Before doing any git operation, ensure credentials are bridged:
  gh auth setup-git

### Cloning
Always clone using GitHub CLI to inherit permissions automatically:
  gh repo clone <owner>/<repo>

Never use plain `git clone https://...` — it will hit a credential prompt.

### Branching
Always work on a feature branch. Never commit directly to main:
  git checkout -b feature/your-feature-name

### Pushing & PRs
Use `gh pr create --fill` to push and open a PR non-interactively:
  git add . && git commit -m "your message" && git push origin HEAD
  gh pr create --fill

Never use interactive PR flows — they will stall the agent.

### If git push stalls
Run these to fix permanently:
  gh auth setup-git
  git config --global credential.helper store
Then retry the push.

---

## User Presence & Notifications

The user typically minimizes Termux while tasks run.
NEVER assume the user is watching the terminal.

Use the `notify` shell command in these situations:
- A long-running task has completed
- You need the user's input or a decision before continuing
- An error occurred that requires attention
- You are about to do something destructive or irreversible

### How to use
  notify "your message here"

Tapping the notification brings the user back to Termux.

### Rules
- Do NOT spam — only notify at meaningful checkpoints
- Always notify when done with a multi-step task
- Always notify before destructive operations

### Examples
  notify "Done! Build finished successfully ✅"
  notify "Waiting for your input before I continue — check Termux"
  notify "Error encountered ❌ — cannot proceed without you"
  notify "About to delete old backups — open Termux to confirm"

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PART 5 — FINAL CONFIRMATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

16. Send a final notification when everything is done:
    notify "All set! Gemini + GitHub + Notifications ready 🚀"
Enter fullscreen mode Exit fullscreen mode

What That Prompt Does (Behind the Scenes)

GitHub — The Credential Wall Fix

The standard GitHub setup breaks for AI agents because git push hangs waiting for a human to type a username and password. This prompt solves it permanently using a two-layer approach:

Layer 1 — gh auth setup-git configures git to use the GitHub CLI as its credential provider. Instead of prompting a human, git silently asks gh for the token.

Layer 2 — credential.helper store persists the session so it survives Termux restarts.

Layer 3 — gh pr create --fill lets Gemini open pull requests without any interactive UI prompts.

The Notification System

The notify command wraps termux-notification with settings tuned for heads-up alerts:

Flag Purpose
--priority max Forces a heads-up popup over any app you're using
--sound Audible alert even with screen off
--vibrate 500,200,500 Physical vibration pattern
--action "am start ..." Tapping opens Termux immediately
No --id flag Every call is treated as a new notification — guaranteed to ring

YOLO Mode

YOLO mode disables Gemini's confirmation prompts for every tool call. Without it, Gemini asks permission before every file edit, every shell command, every git operation — making autonomous work nearly impossible.

The alias gemini='gemini --yolo' applies it automatically every time you start a session.

⚠️ Use in trusted environments only. YOLO mode means Gemini executes without asking. Great for your own projects — be thoughtful about sensitive repos.

GEMINI.md

The instructions written to ~/.gemini/GEMINI.md are loaded into Gemini's context on every session, globally. This means:

  • Gemini always knows how to handle GitHub without getting stuck
  • Gemini always knows when and how to send you notifications
  • These rules persist across reboots, new sessions, and new projects

After Setup

Start every future Gemini session just by opening Termux and running:

gemini
Enter fullscreen mode Exit fullscreen mode

YOLO mode is on. Instructions are loaded. Gemini will notify you when it needs you.

You don't have to watch the terminal anymore.


Troubleshooting

Notification doesn't pop up?
Make sure Termux has notification permissions. Go to Android Settings → Apps → Termux → Notifications → Allow.

notify: command not found?
Run source ~/.bashrc or restart Termux. The PATH update needs a fresh shell.

gh auth status shows unauthenticated?
Your token may have expired or have wrong scopes. Generate a new one and re-run Part 1 of the master prompt.

git push still hangs?
Run gh auth setup-git manually, then retry. If it still hangs, run git config --global credential.helper store and push once manually to cache credentials.


Built on Android. Runs while you sleep. Pings you when it matters.

Top comments (0)