自建Git服务器实现一键重装恢复

自建Git服务器实现一键重装恢复 最近花了点时间把Mac上的工作环境整理了一下,核心是搭建了一套Git服务器方案,目标是:系统重装后10分钟内完全恢复所有工作配置。 背景 平时在Mac mini上跑OpenClaw和一些技能脚本,配置文件、记忆文件、技能代码散落在各处。之前用本地备份脚本,但不够优雅。现在改用Git集中管理,配合Git服务器的匿名访问功能,实现真正的一键恢复。 架构 服务器: Debian虚拟机 (10.10.10.230) 客户端: Mac mini (SSH密钥认证) 备份策略: Git + Git Daemon匿名只读 仓库设计 设计了4个仓库,各司其职: 仓库 用途 访问方式 openclaw-memory 记忆文件、AGENTS.md、MEMORY.md SSH读写 openclaw-skills 技能代码(不含node_modules) SSH读写 openclaw-dotfiles .zshrc、Brewfile、SSH公钥 SSH读写 openclaw-recovery 恢复脚本、私钥、文档 Git匿名只读 关键点在于recovery仓库:它包含SSH私钥和恢复脚本,通过Git Daemon提供匿名只读访问。这意味着重装系统后,无需任何认证就能获取私钥,然后自动配置SSH,再拉取其他仓库。 服务器配置 1. 创建Git用户和仓库 useradd -m -d /home/git -s /bin/bash git mkdir -p /srv/git cd /srv/git git init –bare openclaw-memory.git git init –bare openclaw-skills.git git init –bare openclaw-dotfiles.git git init –bare openclaw-recovery.git ...

2026-02-14 · 2 min

OpenClaw 安装与入门:从 0 到可用(含常见问题)

OpenClaw 是一个你可以部署在自己设备上的个人 AI 助理:它通过你常用的聊天软件(如 Telegram/WhatsApp/Slack/Discord 等)和你对话,也能运行工具(浏览器、文件、定时任务、节点设备等),核心由一个常驻后台的 Gateway 负责调度。 本文以“最快跑起来 + 最少踩坑”为目标,把官方文档与社区教程的关键步骤整理成一篇可直接照做的安装指南。 1. 安装前准备1.1 系统与运行时Node.js:建议 Node >= 22(官方文档以此为前提) macOS / Linux:直接按本文步骤即可 Windows:建议使用 WSL2 (Ubuntu),原生 Windows 环境兼容性与工具链较麻烦 验证 Node 版本: “`bash node -v “` 2. 安装 OpenClaw CLI官方推荐一键脚本(macOS / Linux): “`bash curl -fsSL https://openclaw.ai/install.sh | bash “` Windows PowerShell: “`powershell iwr -useb https://openclaw.ai/install.ps1 | iex “` 也可以选择全局安装: “`bash npm install -g openclaw@latest 或pnpm add -g openclaw@latest “` 3. 运行引导向导(onboard)安装完成后,建议直接跑向导,它会把“模型、网关、工作区、渠道、技能、后台服务”等一次性配好: “`bash openclaw onboard –install-daemon ...

2026-02-08 · 2 min

Debian12 网卡批量dhcp设置

[]

2026-01-07 · 1 min

V8常用命令

[{“source”:{“position”:0,“lines”:["<h2 style="" id="%E6%A0%B8%E5%BF%83%E5%90%AF%E5%8A%A8%E6%9C%8D%E5%8A%A1">核心启动服务<p style="">systemctl start autotrae-core <h2 style="" id="%E6%A0%B8%E5%BF%83%E5%81%9C%E6%AD%A2%E6%9C%8D%E5%8A%A1">核心停止服务<p style="">systemctl stop autotrae-core <h2 style="" id="%E6%A0%B8%E5%BF%83%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1">核心重启服务<p style="">systemctl restart autotrae-core <h2 style="" id="%E6%A0%B8%E5%BF%83%E6%9F%A5%E7%9C%8B%E6%97%A5%E5%BF%97">核心查看日志<p style="">journalctl -u autotrae-core -f <h2 style="" id="%E6%A0%B8%E5%BF%83%E6%9C%8D%E5%8A%A1%E5%85%B3%E9%97%AD">核心服务关闭<p style="">systemctl disable autotrae-core <h2 style="" id="%E6%8E%A8%E6%B5%81%E5%90%AF%E5%8A%A8%E6%9C%8D%E5%8A%A1">推流启动服务<p style="">systemctl start autotrae-stream <h2 style="" id="%E6%8E%A8%E6%B5%81%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1">推流重启服务<p style="">systemctl restart autotrae-stream <h2 style="" id="%E6%8E%A8%E6%B5%81%E6%9F%A5%E7%9C%8B%E6%97%A5%E5%BF%97">推流查看日志<p style="">journalctl -u autotrae-stream -f <h2 style="" id="%E6%8E%A8%E6%B5%81%E5%85%B3%E9%97%AD%E6%9C%8D%E5%8A%A1">推流关闭服务<p style="">systemctl disable autotrae-stream <h2 style="" id="%E7%B4%A7%E6%80%A5%E5%81%9C%E6%AD%A2">紧急停止<p style="">cd /root/autotrae && touch quant-core/STOP.lock <h2 style="" id="%E8%A7%A3%E9%99%A4%E9%94%81%E5%AE%9A">解除锁定<p style="">cd /root/autotrae && rm quant-core/STOP.lock ...

2026-01-01 · 1 min

Log2html debian命令

[{“source”:{“position”:0,“lines”:["<h2 style="" id="%E8%BF%9B%E5%85%A5%E7%9B%AE%E5%BD%95">进入目录cd /usr/share/caddy/<h2 style="" id="%E5%BC%80%E6%9C%BA%E8%87%AA%E5%90%AF">开机自启cd /usr/share/caddy && chmod +x install_log2html_service.sh && ./install_log2html_service.sh<h2 style="" id="%E6%B5%8B%E8%AF%95log2html">测试log2htmlcd /usr/share/caddy && node log2html.js<h2 style="" id="%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1">重启服务systemctl restart log2html.service<h2 style="" id="%E5%A4%87%E4%BB%BDlog2html">备份log2html<p style="">cp /usr/share/caddy/log2html.js /usr/share/caddy/log2html.js.bak "]},“target”:{“position”:0,“lines”:["<h2 style="" id="%E8%BF%9B%E5%85%A5%E7%9B%AE%E5%BD%95">进入目录cd /usr/share/caddy/<h2 style="" id="%E5%BC%80%E6%9C%BA%E8%87%AA%E5%90%AF">开机自启cd /usr/share/caddy && chmod +x install_log2html_service.sh && ./install_log2html_service.sh<h2 style="" id="%E6%B5%8B%E8%AF%95log2html">测试log2htmlcd /usr/share/caddy && node log2html.js<h2 style="" id="%E6%9A%82%E5%81%9C%E6%9C%8D%E5%8A%A1">暂停服务systemctl stop log2html.service<h2 style="" id="%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1">重启服务systemctl restart log2html.service<h2 style="" id="%E5%85%B3%E5%81%9C%E6%9C%8D%E5%8A%A1">关停服务systemctl disable log2html.service<h2 style="" id="%E6%9F%A5%E7%9C%8B%E6%97%A5%E5%BF%97">查看日志journalctl -u log2html.service -f<h2 style="" id="%E5%A4%87%E4%BB%BDlog2html">备份log2htmlcp /usr/share/caddy/log2html.js /usr/share/caddy/log2html.js.bak<p style=""> "]},“type”:“CHANGE”}]

2025-12-09 · 1 min

auto_trade_js_V6 debian命令

[{“source”:{“position”:0,“lines”:["<h2 style="" id="%E5%AE%89%E8%A3%85%E7%8E%AF%E5%A2%83">安装环境cd /root/okx_strategy_js && chmod +x install_library.sh && ./install_library.sh<h2 style="" id="%E6%B5%8B%E8%AF%95%E5%90%AF%E5%8A%A8">测试启动cd /root/okx_strategy_js && node run.js<h2 style="" id="%E5%BC%80%E6%9C%BA%E8%87%AA%E5%90%AF">开机自启cd /root/okx_strategy_js && chmod +x install_okx_service.sh && ./install_okx_service.sh<h2 style="" id="%E6%9A%82%E5%81%9C%E6%9C%8D%E5%8A%A1">暂停服务systemctl stop okx_strategy.service<h2 style="" id="%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1">重启服务systemctl restart okx_strategy.service<h2 style="" id="%E5%85%B3%E5%81%9C%E6%9C%8D%E5%8A%A1">关停服务systemctl disable okx_strategy.service<h2 style="" id="%E6%B5%8B%E8%AF%95%E6%A8%A1%E5%BC%8F">测试模式cd /root/okx_strategy_js && node run.js –test<h2 style="" id="%E5%A4%87%E4%BB%BDrun.js">备份run.jscp /root/okx_strategy_js/run.js /root/okx_strategy_js/run.js.bak<p style=""> "]},“target”:{“position”:0,“lines”:["<h2 style="" id="%E5%AE%89%E8%A3%85%E7%8E%AF%E5%A2%83">安装环境cd /root/okx_strategy_js && chmod +x install_library.sh && ./install_library.sh<h2 style="" id="%E6%B5%8B%E8%AF%95%E5%90%AF%E5%8A%A8">测试启动cd /root/okx_strategy_js && node run.js<h2 style="" id="%E5%BC%80%E6%9C%BA%E8%87%AA%E5%90%AF">开机自启cd /root/okx_strategy_js && chmod +x install_okx_service.sh && ./install_okx_service.sh<h2 style="" id="%E6%9A%82%E5%81%9C%E6%9C%8D%E5%8A%A1">暂停服务systemctl stop okx_strategy.service<h2 style="" id="%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1">重启服务systemctl restart okx_strategy.service<h2 style="" id="%E5%85%B3%E5%81%9C%E6%9C%8D%E5%8A%A1">关停服务systemctl disable okx_strategy.service<h2 style="" id="%E6%B5%8B%E8%AF%95%E6%A8%A1%E5%BC%8F">测试模式cd /root/okx_strategy_js && node run.js –test<h2 style="" id="%E5%BF%AB%E6%8D%B7%E4%B9%B0%E5%85%A5"> 快捷买入cd /root/okx_strategy_js && node run.js –b<h2 style="" id="%E5%BF%AB%E6%8D%B7%E5%8D%96%E5%87%BA">快捷卖出cd /root/okx_strategy_js && node run.js –s<h2 style="" id="%E5%A4%87%E4%BB%BDrun.js">备份run.jscp /root/okx_strategy_js/run.js /root/okx_strategy_js/run.js.bak<p style=""> ...

2025-12-05 · 1 min

外出已归

[{“source”:{“position”:0,“lines”:["<p style="">已经从珠海回来了,昨天去把医保搞了一下,搞定前花了几分钟不超过10分钟吧,就搞完了,效率很高,4号到时候又要去一趟成都啊,一个人去的,不知道那天到时候会不会把事情搞完,还是说要在那里留宿现场不知道,反正到时候去了再说吧! <p style="">现在天气已经很冷了,山上已经开始打霜了,里面温度还可以,有个10度左右吧,今天也不知道写啥,反正就随便说两句。 <p style="">对了,还有一件事就是自动交易系统,现在已经进化到第八版来了第八版的效果执行效果还可以,就是看策略行不行,反正让他持续运行几年吧,计划是一个周期,也就是大概四年,希望这次我能顶住啊,顶住! "]},“target”:{“position”:0,“lines”:["<p style="">已经从珠海回来了,昨天去把医保搞了一下,搞定前后花了几分钟不超过10分钟吧,就搞完了,效率很高。 <p style="">4号到时候又要去一趟成都啊,一个人去的,不知道那天到时候会不会把事情搞完,还是说要在那里留宿现在不知道,反正到时候去了再说吧! <p style="">现在天气已经很冷了,山上已经开始打霜了,市区温度还可以,有个10度左右吧,今天也不知道写啥,反正就随便说两句。 <p style="">对了,还有一件事就是自动交易系统,现在已经进化到第八版来了,第八版的效果执行效果还可以,就是看策略行不行,反正让他持续运行几年吧,计划是一个周期,也就是大概四年,希望这次我能顶住啊,顶住! "]},“type”:“CHANGE”}]

2025-12-02 · 1 min

再去珠海

[]

2025-11-23 · 1 min

在debian系统里如何让python代码在后台运行?_第三版_多账户版本

[{“source”:{“position”:0,“lines”:["<p style="">在 root 下添加为开机自启(使用 systemd,服务以 root 身份运行)。将下面内容写入 /etc/systemd/system/liu_btc_trade_strategy.service 并启用: <p style="">创建 unit 文件: <p style="">Code sudo tee /etc/systemd/system/liu_btc_trade_strategy.service > /dev/null <<‘EOF’"]},“target”:{“position”:0,“lines”:["<p style="">在 root 下添加为开机自启(使用 systemd,服务以 root 身份运行)。将下面内容写入 /etc/systemd/system/okx_multi_account.service 并启用: <p style="">创建 unit 文件: <p style="">Code sudo tee /etc/systemd/system/okx_multi_account.service > /dev/null <<‘EOF’"]},“type”:“CHANGE”},{“source”:{“position”:2,“lines”:[“Description=liu_btc_trade_strategy Python service (run as root)”]},“target”:{“position”:2,“lines”:[“Description=okx_multi_account Python service (run as root)”]},“type”:“CHANGE”},{“source”:{“position”:8,“lines”:[“WorkingDirectory=/home/liu”,“ExecStart=/usr/bin/python3 /home/liu/liu_btc_trade_strategy.py”]},“target”:{“position”:8,“lines”:[“WorkingDirectory=/home/auto_trade”,“ExecStart=/usr/bin/python3 /home/auto_trade/okx_multi_account.py”]},“type”:“CHANGE”},{“source”:{“position”:18,“lines”:[“sudo systemctl enable –now liu_btc_trade_strategy.service”,"<ol start="3"><p style="">管理与查看: <p style="">Code sudo systemctl status liu_btc_trade_strategy.service",“sudo journalctl -u liu_btc_trade_strategy.service -f”,“sudo systemctl stop liu_btc_trade_strategy.service”,“sudo systemctl disable liu_btc_trade_strategy.service”,"<p style="">注意: ...

2025-10-17 · 1 min

Microsoft 激活脚本 (MAS)

开源 Windows 和 Office 激活器,具有 HWID、Ohook、TSforge、KMS38 和在线 KMS 激活方法以及高级故障排除功能。 如何激活 Windows/Office/扩展更新 (ESU) 方法 1 - PowerShell 信息 打开 PowerShell 单击开始菜单,输入PowerShell,然后打开它。 复制并粘贴以下代码,然后按回车键。 对于Windows 8、10、11: irm https://get.activated.win | iex对于Windows 7及更高版本: iex ((New-Object Net.WebClient).DownloadString('https://get.activated.win'))脚本未启动单击此处获取信息。 如果上述操作被阻止(被 ISP/DNS),请尝试以下操作(需要更新 Windows 10 或 11): iex (curl.exe -s --doh-url https://1.1.1.1/dns-query https://get.activated.win | Out-String) 如果失败或者您使用的是旧版 Windows,请使用方法 2。 激活菜单将会出现。选择绿色突出显示的选项来激活 Windows 或 Office。 完毕!

2025-09-01 · 1 min