做详情页哪个网站好,用地方名字做网站,营销策略范文,营销型网站制作哪家好思路#xff1a;
1. ssh 配置
2. reps.txt 列出所有仓库名
3. exp的自动化备份脚本
--
环境安装#xff1a;
exp需要依赖安装的文件#xff0c;所以先执行下(以ubuntu为例)#xff1a; sudo apt-get install expect
操作步骤#xff1a;
ssh 配置
1. 添加公钥至 …思路
1. ssh 配置
2. reps.txt 列出所有仓库名
3. exp的自动化备份脚本
--
环境安装
exp需要依赖安装的文件所以先执行下(以ubuntu为例) sudo apt-get install expect
操作步骤
ssh 配置
1. 添加公钥至 Gitee(Linux服务器) ssh-keygen -t rsa -C your_emailexample.com -f ~/.ssh/gitee cat ~/.ssh/gitee.pub 2. 编写 config 文件 在 ~/.ssh/ 目录中创建或编辑 config 文件添加以下内容
Host GiteeUser gitHostname gitee.comIdentityFile ~/.ssh/gitee注意事项 确保 ~/.ssh/ 目录和 config 文件的权限设置正确。通常使用以下命令设置权限 chmod 700 ~/.ssh
chmod 600 ~/.ssh/gitee
chmod 600 ~/.ssh/config整理需要clone的仓库名称reps.txt rep001 rep002 rep003 自动化备份脚本
vim clone_repos.exp
#!/usr/bin/expectset original_dir [pwd] ;# 记录当前的原始目录
set rep [open reps.txt]
while { [gets $rep line] ! -1 } {set repo_path Gitee:chihj/$line.gitset mirror_path $line.git ;# 假设镜像仓库存储在当前目录下名称为 $line.git# 检查镜像仓库是否存在if {![file exists $mirror_path]} {# 如果不存在克隆镜像spawn git clone --mirror $repo_path} else {# 如果存在进入镜像目录并执行更新cd $mirror_pathspawn git fetch --all --prune}expect {Are you sure you want to continue connecting {send yes\rexpect eof}eof}# 返回到原始目录cd $original_dir
}close $rep
运行
chmod x clone_repos.exp
./clone_repos.exp推荐方案
对于数字资产的长期备份推荐使用 git clone --mirror 和 git fetch --all 的结合方式.
再做个定时任务就OKAY了。