What’s your config (tools etc) for developing a Git repo on Android?
Here’s mine. With it I’ve contributed a translation PR to an app and am able to play with a toy GitHub repo. Apps are available from F-Droid unless marked.
Without setup for Git cloning, you can only make single-file commits to the default branch (main/master) via GitHub web interface. The branch restriction is especially bothering because PRs conventionally use dedicated (non-default) branches.
Termux
-
Run
termux-setup-storageand grant permission to storage -
pkg install git -
~/.gitconfig:[core] pager = [user] email = ID+USERNAME@users.noreply.github.com name = NAME [http] postBuffer = 1073741824 [push] autoSetupRemote = true [alias] sb = status -sb force-push = push --force-with-lease #lg = log --oneline lg = log --pretty=tformat:'%C(dim)%C(bold)%h%C(auto)%d %s' cl = clone --no-single-branch lgwithdate = log --pretty=tformat:'%C(dim)%as %C(bold)%h%C(auto)%d %s'- Disable pager (
pager =) as it seems broken otherwise on my device - Email and name can be set to GitHub noreply email and username respectively if you’d like to hide your real email/name
- Skip the
[http] postBuffer = 1073741824if you like; it doesn’t visibly improve cloning/pushing speed for me [push] autoSetupRemote = truewill automatically push branches to remote instead of needing-u originevery time- Command alias (
[alias]) are for convenience, and I will only explain:cl: equivalent to clone but doesn’t enable single-branch mode when using--depth. There is no Git setting to disable auto-single-branch when using--depthso this is a workaround.lgandlgwithdate: the former is equivalent tolog --onelinebut changes the hash’s yellow color to gray and boldens it (personal style choice); the second adds date information in addition to that
- Disable pager (
-
Optional: set up a “put anything here / temp directory” folder
- Create a file
~/.gitignore_globalcontainingtand set[core] excludesFile = /data/data/com.termux/files/home/.gitignore_global[1] - The folder
twill then be ignored in every repo without needing to tweak repos’ .gitignore
- Create a file
-
Recommended commit method:
git commit -F -
Ghost Commander
Bookmarks for convenience:
-
content://com.termux.documents/tree/%2Fdata%2Fdata%2Fcom.termux%2Ffiles%2Fhome/document/%2Fdata%2Fdata%2Fcom.termux%2Ffiles%2Fhomefor easy Termux access. This is equivalent to Termux path~and is reachable from SAF[2]. You’ll need to keep Termux open and grant permission. -
Create and bookmark a dedicated folder in non-Termux storage for putting some things there
After granting Ghost Commander access to Termux storage, I use it as the primary tool for editing files.
GitHub (web UI)
Set up a personal access token because GitHub doesn’t accept password authentication anymore. Store it inside Termux storage (which is private).[3] It wil be asked for when you run git push. I can’t pipe it into Git so I have to copy-paste every time. ![]()