当前位置: 首页 > news >正文

【Ubuntu22.04】repo安装方法

背景

repo是Google开发的用于基于git管理Android版本库的一个工具,管理多个Git仓库的工具,它可以帮助您在一个代码库中管理多个Git仓库的代码。其在鸿蒙操作系统中大量使用。下面我们就介绍repo在wsl中的安装部署。

安装方法

  1. 使用中国科技大学资源

脚本install_repo.sh:

mkdir -p ~/.bin/repo
git clone https://gerrit-googlesource.lug.ustc.edu.cn/git-repo ~/.bin/repo
chmod +x ~/.bin/repo/repo
echo 'export PATH=~/.bin/repo:$PATH' >> /root/.bashrc
source ~/.bashrc

脚本执行后重开终端。验证:

root@DESKTOP-UKR8O1E:~# repo --version
<repo not installed>
repo launcher version 2.54(from /root/.bin/repo/repo)
git 2.34.1
Python 3.10.12 (main, Feb  4 2025, 14:57:36) [GCC 11.4.0]
OS Linux 5.10.16.3-microsoft-standard-WSL2 (#1 SMP Fri Apr 2 22:23:49 UTC 2021)
CPU x86_64 (x86_64)
Bug reports: https://issues.gerritcodereview.com/issues/new?component=1370071
  1. 使用清华大学资源

脚本install_repo.sh:

mkdir -p ~/.bin/repo
git clone https://mirrors.tuna.tsinghua.edu.cn/git/git-repo ~/.bin/repo
chmod +x ~/.bin/repo/repo
echo 'export PATH=~/.bin/repo:$PATH' >> /root/.bashrc
source ~/.bashrc

脚本执行后重开终端。验证省略。

使用问题集锦

  • repo init 提示“fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle“
root@DESKTOP-R500S71:/home/work# repo init -u https://gitee.com/ark-standalone-build/manifest.git -b master
Downloading Repo source from https://gerrit.googlesource.com/git-repo
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error [Errno 110] Connection timed out
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

原因:国内网络限制,无法访问https://gerrit.googlesource.com/git-repo/clone.bundle
解决方法:
替换脚本replace_repo_url.sh,替换REPO_URL 内容为:https://mirrors.tuna.tsinghua.edu.cn/git/git-rep

#!/bin/bash# 查找repo路径
REPO_PATH=$(which repo)if [ -z "$REPO_PATH" ]; thenecho "错误:未找到repo命令"exit 1
fi# 备份原始文件
BACKUP_PATH="${REPO_PATH}.bak"
echo "备份原始文件到 ${BACKUP_PATH}..."
sudo cp "$REPO_PATH" "$BACKUP_PATH"# 执行替换操作
echo "执行URL替换..."
sudo sed -i 's|https://gerrit.googlesource.com/git-repo|https://mirrors.tuna.tsinghua.edu.cn/git/git-repo|g' "$REPO_PATH"if [ $? -eq 0 ]; thenecho "替换成功完成!"
elseecho "替换过程中出现错误,已恢复备份"sudo mv "$BACKUP_PATH" "$REPO_PATH"exit 1
fi

文章转载自:
http://actualize.sxnf.com.cn
http://assiduously.sxnf.com.cn
http://anticorrosion.sxnf.com.cn
http://aaui.sxnf.com.cn
http://barehanded.sxnf.com.cn
http://bindwood.sxnf.com.cn
http://briefs.sxnf.com.cn
http://anatomize.sxnf.com.cn
http://barramunda.sxnf.com.cn
http://carbon.sxnf.com.cn
http://aeromancy.sxnf.com.cn
http://chitling.sxnf.com.cn
http://apoferritin.sxnf.com.cn
http://anatoxin.sxnf.com.cn
http://appellatively.sxnf.com.cn
http://bessemerize.sxnf.com.cn
http://aerogenerator.sxnf.com.cn
http://bottleneck.sxnf.com.cn
http://apollonian.sxnf.com.cn
http://amusing.sxnf.com.cn
http://chapstick.sxnf.com.cn
http://archivist.sxnf.com.cn
http://aphlogistic.sxnf.com.cn
http://baywood.sxnf.com.cn
http://arrestment.sxnf.com.cn
http://anneal.sxnf.com.cn
http://austere.sxnf.com.cn
http://barbaric.sxnf.com.cn
http://blub.sxnf.com.cn
http://aleatoric.sxnf.com.cn
http://www.dtcms.com/a/280678.html

相关文章:

  • Linux715 磁盘管理:逻辑卷
  • 聊聊MySQL中的buffer pool
  • Spring Boot目录变文件夹?3步解决!
  • Unity Editor下拉框,支持搜索,多层级
  • BGP服务器和多线服务器的不同之处
  • Python初学者笔记第十三期 -- (常用内置函数)
  • 原点安全签约金网络数科,共建一体化数据安全防护体系
  • Docker 镜像(Image)常用命令总结
  • ASP .NET Core 8结合JWT轻松实现身份验证和授权
  • CMake基础:覆盖项目开发的五大配套工具
  • LLM面试题及讲解 4
  • VSCode同时支持Vue2和Vue3开发的插件指南
  • 【编程】-环形缓冲区
  • 安全参綉25暑假第一次作业
  • 超详细 anji-captcha滑块验证uniapp微信小程序前端组件
  • 备忘录设计模式
  • asyncio 与 uvloop
  • 策略设计模式分析
  • 如何将华为文件传输到电脑
  • Linux的用户和用户组与权限解析、环境变量说明与配置、sudo配置解析和使用
  • HarmonyOS从入门到精通:自定义组件开发指南(七):自定义事件与回调
  • 涨停板池,跌停板池,炸板池,次新股池,强势股池数据接口
  • 单臂路由实现VLAN互通实验
  • e签宝电子合同成为白象食品数字化转型中的关键一环
  • PostgreSQL 超详细安装与使用教程:从入门到实战
  • 深入剖析 React Server Components:原理、应用与性能优势
  • 设计模式一: 模板方法模式 (Template Method Pattern)
  • Nexus 私服管理工具
  • 李宏毅《生成式人工智能导论》 | 第11讲-第14讲:大型语言模型的可解释性、能力评估、安全性
  • 20250715问答课题-基于BERT与混合检索问答系统