================================ 1. 进入博客仓库 ================================ cd ~/gitdemo ================================ 2. 创建配置备份目录 ================================ mkdir -p config/termux ================================ 3. 备份核心配置文件 =============================== cp ~/.myfuncs.sh config/termux/ cp ~/.bashrc config/termux/ cp ~/.zshrc config/termux/ cp ~/.profile config/termux/ ================================ 4. 创建【终极版】一键恢复脚本 ================================ cat > config/termux/restore.sh <<'EOF' #!/data/data/com.termux/files/usr/bin/bash # --- 自动安装依赖 --- pkg update -y pkg install -y git zsh curl # --- 自动安装 tmoe-zsh 主题 --- if [ ! -d "$HOME/.config/tmoe-zsh" ]; then bash -c "$(curl -L https://gitee.com/mo2/zsh/raw/master/zsh.sh)" fi # --- 恢复配置文件 --- cp ~/.myfuncs.sh ~/ cp ~/.bashrc ~/ cp ~/.zshrc ~/ cp ~/.profile ~/ # --- 应用配置 --- source ~/.bashrc echo "✅ Termux 配置已恢复" EOF 然后执行 chmod +x config/termux/restore.sh ./config/termux/restore.sh — 自动安装依赖 — echo "🔧 正在检查并安装基础依赖..." pkg update -y pkg install -y git zsh curl — 自动安装 tmoe-zsh 主题 — 文档链接1 中提供了 gitee 和 github 两个源,优先使用国内 gitee 源 echo "🎨 正在安装 tmoe-zsh 主题..." if [ ! -d "$HOME/.config/tmoe-zsh" ]; then bash -c "$(curl -L https://gitee.com/mo2/zsh/raw/master/zsh.sh)" else echo "tmoe-zsh 已存在,跳过安装。" fi — 恢复配置文件 — echo "📂 正在恢复配置文件..." cp ~/.myfuncs.sh ~/ cp ~/.bashrc ~/ cp ~/.zshrc ~/ cp ~/.profile ~/ — 应用配置 — source ~/.bashrc echo "" echo "✅✅✅ Termux 环境、主题及配置已全部恢复完成!" EOF ================================ 5. 赋予脚本执行权限 =============================== chmod +x config/termux/restore.sh ================================ 6. 提交并推送到 GitHub(永久保存) ================================ git add config/termux git commit -m "更新 restore.sh:集成依赖与主题自动安装" git push gitdemo master 重装 Termux(以后用) ================================ 1. 基础初始化(只需这两条) ================================ termux-change-repo # 切换国内源(推荐) termux-setup-storage # 如需访问手机存储则执行 ================================ 2. 克隆仓库(使用规范的 URL) ⚠️ 第一次会要求输入: - GitHub 用户名 - Personal Access Token(不是密码) ================================ git clone https://github.com/sxgpyjg/sxgpyjg.github.io.git gitdemo ================================ 3. 一键全自动恢复(核心步骤) ================================ cd gitdemo ./config/termux/restore.sh ================================ 4. 以后日常写作 ================================ yjg "我的新文章"