Post

github repo 环境搭建

记录在mac 上怎么搭建 repo 环境并拉代码到本地

1、安装python

  • 1.1运行命令安装
    1
    
    brew install python
    
  • 1.2 配置路径
    1
    
    open .bash_profile
    

    因为我是安装的3.12版本所以是python@3.12

    1
    
    export PATH="/opt/homebrew/opt/python@3.12/bin:$PATH"
    

    保存

    1
    
    source .bash_profile
    

    如果你觉得上面三个步骤太麻烦也可以在命令行界面输入如下

    1
    
    echo 'export PATH="/opt/homebrew/opt/python@3.12/bin:$PATH"' >> ~/.zshrc
    
  • 1.3 查看python 版本
    1
    
    python3 --version
    

2、安装repo

  • 2.1 用brew 安装repo
    1
    
    brew install repo
    
  • 2.2 配置repo 环境
    1
    2
    
    # repo
    export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
    
  • 2.3 保存设置
    1
    
    source .bash_profile
    
  • 2.4 查看repo 版本 Build source 如果你在Terminal 效果和这个一样,说明你的repo 已经安装好了

  • 2.5 书写repo的 manifest 请参考 我的demo

3、下载代码

因为RepoPractice只有 main 分支 所以 -b 是main

1
2
repo init -u https://github.com/frankie9527/RepoPractice  -b main -m default.xml
repo sync
This post is licensed under CC BY 4.0 by the author.