The goal: real SSH and git from your pocket
Once you have running a Linux shell on iPhone with iSH working, the most useful thing you can do with it is talk to other machines. This guide sets up SSH and git on iPhone using iSH: a proper key pair, a tidy ~/.ssh/config, and a repository you can clone, commit to and push back to GitHub or your own server.
Install the tools
Both come from Alpine’s repositories. If you haven’t used apk yet, read installing packages in iSH with apk first.
apk update
apk add openssh-client git
Set your git identity once:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main
Generate an SSH key
Ed25519 keys are short, fast and supported by GitHub, GitLab and any modern OpenSSH server:
ssh-keygen -t ed25519 -C "iphone-ish"
Accept the default path (~/.ssh/id_ed25519) and set a passphrase. Your phone gets lost more often than your desktop does, so a passphrase matters here. Then print the public key:
cat ~/.ssh/id_ed25519.pub
Long-press to copy it and add it to GitHub under Settings > SSH and GPG keys, or append it to ~/.ssh/authorized_keys on your server. Give this key its own name so you can revoke just the phone if you need to.
Write an ssh config
Typing full hostnames and usernames on a phone keyboard gets old quickly. Create ~/.ssh/config:
Host github.com
User git
IdentityFile ~/.ssh/id_ed25519
Host homelab
HostName 192.168.1.20
User jonathan
Port 22
IdentityFile ~/.ssh/id_ed25519
ServerAliveInterval 30
Lock down the permissions, because OpenSSH refuses keys and configs that other users can read:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/config ~/.ssh/id_ed25519
Now ssh homelab is all you need. ServerAliveInterval helps keep the connection alive over mobile data. Test GitHub with:
ssh -T git@github.com
Clone, commit and push
With the key in place, git works much as it does anywhere else:
git clone git@github.com:yourname/notes.git
cd notes
vim todo.md
git add todo.md
git commit -m "Update todo from phone"
git push
For quick edits to notes, dotfiles or a static site, this is genuinely handy. If you want to edit the files in a nicer iOS editor, clone into a folder you’ve mounted from the Files app, which I cover in accessing iOS files in iSH.
Avoid retyping your passphrase
Start an agent for the session and add your key once:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
The agent lives only as long as the iSH session, so you’ll do this again after iOS kills the app.
Limitations and troubleshooting
- Backgrounding: iOS suspends apps you switch away from, so SSH sessions drop. The iSH wiki documents a workaround that keeps the app alive by reading
/dev/location, which turns on location tracking. Decide whether that trade-off suits you;tmuxon the remote server is the cleaner fix. - Slow clones: git runs under x86 emulation, so big repositories with long histories are slow. Use
git clone --depth 1when you only need the latest files. - Permission denied (publickey): check the permissions above, then run
ssh -vto see which key is offered. - Running an SSH server in iSH: it works, but the wiki notes SFTP clients may not connect. Treat iSH as a client.
- No mosh roaming luxuries: mosh is listed as working, but if you live in SSH sessions all day, a dedicated client is better. See iSH vs a-Shell vs Blink Shell.
Wrapping up
SSH and git on iPhone with iSH gives you a real OpenSSH client and real git, not a cut-down imitation. Use a passphrase-protected key that’s unique to the phone, keep your config tidy, and use shallow clones for anything large. It won’t replace your laptop, but it will get you out of a hole when a server needs attention and you’re away from your desk.
iSH: Linux on your iPhone series. Start with the original guide to running a Linux shell on iPhone with iSH, then:
- Installing packages in iSH with apk
- SSH and git on iPhone with iSH
- Python and Node in iSH
- iSH vs a-Shell vs Blink Shell
- Accessing iOS files in iSH

Leave a Reply
You must be logged in to post a comment.