Passa al contenuto principale

How to save git project file on Android

· Lettura di 1 minuto

How to connect to your Android using SSH with cable with ADB

# 1. install Termux (use F-Droid)
# 2. update Termux
pkg update && pkg upgrade
pkg install termux-services
# 3. install git and openssh
pkg install git openssh
# 4. setup ssh server
passwd # setup termux password
sshd # start ssh server
# 5. get username
whoami
# --- now on pc
# 0. install adb
# 1. close adb
adb kill-server
# 2. connect the android, use a cable with Vcc, Gnd pairs, Data+, Data-
# 3. authorize device
adb devices
# 2. do port forwarding
adb forward tcp:8022 tcp:8022
# 3. connect to android using the port
ssh -p 8022 username@localhost
# example:
# ssh -p 8022 u0_a334@localhost

Setup git bare repo

# 1. ssh into termux
ssh -p 8022 u0_a334@localhost
# home is in:
# /data/data/com.termux/files/home
# 2. create dir
mkdir -p ~/git/mio-progetto.git
cd ~/git/mio-progetto.git
git init --bare
# --- now on pc
git clone ssh://u0_a334@localhost:8022/data/data/com.termux/files/home/git/myqrdocs.git
# on config --list you should see the full connection URL
git config --list
# you can now commit and push
git commit -m ""
git push origin