Android 使用 Termux 安装 Git 和 SSH

背景

在 Android 上使用 Git 客户端。
可选工具:
1.Pocket Git & MGit 客户端
2.Termux 安装 Git(选用)
下面介绍使用 Termux 安装 Git 和通过 SSH 远程连接 Termux。

1.换源

运行 termux-change-repo 命令,通过图形界面替换成 TUNA/BFSU 镜像源即可。

2.ssh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 安装open-ssh
pkg install openssh

# 报错:CANNOT LINK EXECUTABLE "ssh-keygen": library "libcrypto.so.3" not found: needed by main executable
# 解决:安装 openssl1.1-tool。这里必须要指定版本,否则报错 library “libssl.so.1.1“ not found
pkg install openssl1.1-tool

# 生成密钥
ssh-keygen -A

# 启动ssh
sshd

# 查看用户名
whoami

# 查看ip
ifconfig

# 设置密码
passwd

# 远程登录ssh连接termux,默认端口8022
ssh -p8022 uxxx@192.168.1.1

3.文件访问权限

1
termux-setup-storage

输出:

1
/data/data/com.termux/files/usr/bin/termux-setup-storage: line 24: 25567 Aborted                 am broadcast --user 0 --es com.termux.app.reload_style storage -a com.termux.app.reload_style com.termux > /dev/null

解决:

1
pkg install termux-am

安装 Git

1
pkg install git

clone 项目。

参考

termux-change-repo换源
mac ssh 连接 android termux
library “libssl.so.1.1“ not found解决
termux-setup-storage输出line 24: 25567 Aborted解决
Termux配置教程