在Windows上 安装使用repo

在Windows上 安装使用repo

一、repo简介

一个大型项目通常会有多个仓库构成,比如 Android 项目,通过 manifest 清单(xml 文件)定义一个项目中各个 git 代码仓库的关联,而 repo 就是在这种项目组织方式下的一个用于多仓库协同开发和代码评审的一个客户端工具。

repo 是使用 python 开发实现的,需要安装 python 才能运行,repo 可以用于下载和提交代码,以及对多个代码仓库同时执行 git 命令,在他的官网上可以找到更多关于repo的介绍资料:。

二、Window系统安装使用repo

原始的 Google repo 工具仅支持在 Linux 系统下运行,现在支持 python 2 和 python 3,但无法在 Windows 上使用,这使得一些在 Windows 系统环境下开发的项目使用 repo 不太方便。

如果需要在Windows下使用,可以使用第三方的 ,按照官网介绍下载安装repo,并添加环境变量就可以使用了,目前仅支持 python2,esrlabs repo 的命令参数兼容原始的google repo,这算是 Windows 下使用 repo 的一个替代方案。如果使用的是 Windows 10,还可以在 Windows 10 的Linux 子系统下安装原始 repo,在 Linux 子系统进行多仓库管理,这是第二个方案。

www.zeeklog.com  - 在Windows上 安装使用repo


第三个方案是使用 go 语言开发 git-repo 替代 repo,下面介绍 git-repo 的安装和使用。

三 git-repo安装与使用

git-repo 是一个使用 go 编写的仓库管理工具,与原始 repo 相比,支持 Windows、Mac 和 Linux 系统,除了git,没有其他软件依赖,兼容多数原始的 repo 命令,速度也比 python 编写的 repo 快,所以在 Windows 平台上 git-repo 算是一个很好的替代原始 repo 的选择,它的官网地址为:,可以了解更多信息。

安装git-repo

首先去  下载对应平台的二进制执行文件,然后将其添加到环境变量。

www.zeeklog.com  - 在Windows上 安装使用repo


需要说明的是,对于Windows系统,需要将git-repo.exe可执行文件拷贝到C:\Windows\System32目录下,然后将C:\Windows\System32\git-repo.exe添加到系统环境变量中,如下图所示。

www.zeeklog.com  - 在Windows上 安装使用repo


然后,打开 git bash,能够正确执行 git repo version 命令说明安装好了。

$ git repo version
git-repo version 0.7.8
git version 2.22.0.windows.1

基本使用

git-repo 在使用上是作为 git 的一个子命令 git repo 来使用的,在 git repo 后面输入命令参数。

初始化项目:git repo init -u < manifest-url>

$ git repo init -u [email protected]:qioixiy/manifests.git
Warning: Permanently added the ECDSA host key for IP address '212.64.62.183' to the list of known hosts.
remote: Enumerating objects: 17, done.
remote: Total 17 (delta 0), reused 0 (delta 0), pack-reused 17
Unpacking objects: 100% (17/17), done.
From gitee.com:qioixiy/manifests
 * [new branch]      master     -> origin/master
Note: checking out '20dd4a7db47f19b7e59f4e880a46ac9732cd4986'.


You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.


If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:


  git checkout -b <new-branch-name>


HEAD is now at 20dd4a7 Add trac into dev-env
Switched to a new branch 'default'
NOTE: Your identity is: hacper <git>
NOTE: If you want to change this, please re-run 'git repo init' with --config-name
NOTE: repo has been initialized in G:\Workspace\fsl
</git></new-branch-name>

同步代码:git repo sync

$ git repo sync
remote: Enumerating objects: 315, done.
remote: Enumerating objects: 6069, done.
remote: Total 315 (delta 0), reused 0 (delta 0), pack-reused 315
Receiving objects: 100% (315/315), 120.01 KiB | 278.00 KiB/s, done.
Resolving deltas: 100% (126/126), done.
From https://gitee.com/qioixiy/shell.profileiB | 262.00 KiB/s
 * [new branch]      master     -> gitee_qioixiy/master
remote: Total 6069 (delta 0), reused 0 (delta 0), pack-reused 6069
Receiving objects: 100% (6069/6069), 2.35 MiB | 497.00 KiB/s, done.
Resolving deltas: 100% (4069/4069), done.
From https://gitee.com/qioixiy/git-repo
 * [new branch]      main       -> gitee_qioixiy/main
 * [new branch]      master     -> gitee_qioixiy/master
ERROR: 404: bad ssh_info response of 'http://gitee.com/ssh_info'
NOTE: fail to check remote server, you may need to install gerrit hooks by hands
ERROR: fail to load remotes: gitee_qioixiy
Note: checking out 'd7399d9ca2cfe40dcee22f0ea6ce0cdd283e5a78'.


You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.


If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:


  git checkout -b <new-branch-name>


HEAD is now at d7399d9 update home_dot/files/.profile_priv.
Note: checking out '6a2f4fb39073a4e2e6824d5f2f4a1cbf5fe4b766'.


You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.


If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:


  git checkout -b <new-branch-name>


HEAD is now at 6a2f4fb repo init: Added --no-partial-clone and made it persist. Bumped version to 2.14.
</new-branch-name></new-branch-name>

创建新分支:git repo start –all new_branch_name

$ git repo start --all fea/test
Switched to a new branch 'fea/test'
Switched to a new branch 'fea/test'

提交代码: git repo upload

Read more

【优选算法】(实战解析双指针的神奇奥秘)

【优选算法】(实战解析双指针的神奇奥秘)

🔥承渊政道:个人主页 ❄️个人专栏: 《C语言基础语法知识》《数据结构与算法》《C++知识内容》《Linux系统知识》《算法刷题指南》《测评文章活动推广》 ✨逆境不吐心中苦,顺境不忘来时路!✨🎬 博主简介: 引言:在编程学习的道路上,算法刷题无疑是绕不开的核心环节—它既是检验基础功底的"试金石",也是提升逻辑思维、应对求职面试、突破技术瓶颈的关键路径.但很多学习者都会陷入同样的困境:盲目刷了上百道题,遇到新题目依然无从下手:只会死记硬背题解,换个场景就无法灵活应用;不清楚刷题顺序,在难题中内耗,最终消磨了学习热情,半途而废.事实上,算法刷题从来不是"数量取胜:,而是"方法为王".很多人误以为刷题就是"多做就行",却忽略了背后的逻辑:算法的本质是解决问题的思维模式,刷题的核心目的,是通过刻意练习,掌握不同类型题目的解题思路、拆解技巧,

By Ne0inhk
解锁动态规划的奥秘:从零到精通的创新思维解析(6)

解锁动态规划的奥秘:从零到精通的创新思维解析(6)

解锁动态规划的奥秘:从零到精通的创新思维解析(6) 前言: 在动态规划的众多问题中,多状态DP问题是一个非常重要的类别。它的难点在于如何设计合适的状态表示和转移方程,从而高效地解决问题。 多状态DP的核心思想在于:针对问题的不同属性或限制条件,将状态表示扩展为多个维度,使得状态可以更加精确地描述问题的子结构。这种方法既可以帮助我们更好地分解问题,又能够在求解过程中保留更多的信息,从而为最终的结果提供完整的支持。 在实际应用中,多状态DP常用于解决路径规划、背包问题、字符串编辑、博弈问题等场景。例如,在路径规划问题中,我们可以通过增加状态的维度来描述位置、步数以及路径的某些限制条件;在资源分配问题中,我们可以通过扩展状态来考虑当前的资源利用率和历史决策。 本篇内容将聚焦于多状态DP问题的基本原理和解决方法,结合典型实例,逐步介绍从状态定义、转移方程设计到代码实现的完整过程。希望通过这一系列讲解,读者能够对多状态DP的理论和实践有更深入的理解,掌握其在解决实际问题时的技巧与方法。 今天小编就要开启动态规划的多状态dp问题的讲解了,希望我讲完几篇文章后,对屏幕后的你会有一定程度的

By Ne0inhk
【LeetCode经典题解】:从前序和中序遍历构建二叉树详解

【LeetCode经典题解】:从前序和中序遍历构建二叉树详解

🎁个人主页:User_芊芊君子 🎉欢迎大家点赞👍评论📝收藏⭐文章 🔍系列专栏:Java.数据结构 【前言】 二叉树构造是算法中递归分治思想的经典应用,而通过前序与中序遍历序列还原二叉树,更是力扣考察二叉树特性的高频题。前序“根左右”、中序“左根右”的遍历特性,是逐层确定根节点、划分左右子树的关键。本文将从递归分治思想出发,拆解该问题的实现逻辑,分析代码设计的核心细节。 文章目录: * 一、从前序遍历和中序遍历构造二叉树 * 二、思路分析 * 三、代码详解 * 1.代码分析 * 2.代码展示 一、从前序遍历和中序遍历构造二叉树 链接直达:从前序遍历和中序遍历构造二叉树 二、思路分析 根据递归分治思想: 前序遍历:根节点—>左子树—>右子树;找到前序序列的第一个元素就是根节点;中序遍历:

By Ne0inhk

Haversine 距离算法详解(零基础友好版)

作为算法领域的研究者,我会从用途、核心原理、前置知识、公式拆解、代码实现五个维度,给你讲清楚 Haversine 距离算法 —— 它是计算地球表面两点球面直线距离的经典算法,日常用的地图测距、打车软件预估里程,背后都有它的身影。 一、 算法的核心用途 我们生活的地球是一个近似球体,如果要计算两个地点(比如北京到上海)的 “直线距离”,不能直接用平面几何的勾股定理(因为地球表面是曲面)。 Haversine 算法的作用,就是基于两点的经纬度坐标,计算它们在地球球面上的最短距离(这个最短距离也叫大圆距离,即穿过球心的平面切割球面形成的圆弧长度)。 二、 必须掌握的前置知识 在理解公式前,先记住 3 个关键概念: 1. 经纬度的定义 * 纬度 (latitude):衡量地点南北位置,范围是 [-90°, 90°],赤道是 0°,北极是 90°N,南极是 90°S。

By Ne0inhk