一、 下载repo
直接安装repo会报错。
zjh@ubuntu:~/work/linux_Sunplus/app$ sudo apt-get install repo
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package repo
( 在ubuntu18.04上可以直接安装,但在20.04上就算执行了sudo apt-get update也是不能直接安装的)
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
export PATH=~/bin:$PATH
二、运行repo
repo init -u ssh://xxxx你的库地址 --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/
可以会遇到以下错误:
repo init 会报
/usr/bin/env: ‘python’: No such file or directory
解决方案:
sudo ln -s /usr/bin/python3 /usr/bin/python
如果没有安装则需要安装python3 ( sudo apt-get install python3)
报以下错误:
Traceback (most recent call last):
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/main.py", line 689, in
_Main(sys.argv[1:])
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/main.py", line 665, in _Main
result = run()
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/main.py", line 658, in
run = lambda: repo._Run(name, gopts, argv) or 0
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/main.py", line 299, in _Run
result = cmd.Execute(copts, cargs)
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/subcmds/init.py", line 318, in Execute
self._ConfigureUser(opt)
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/subcmds/init.py", line 172, in _ConfigureUser
name = self._Prompt('Your Name', mp.UserName)
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/project.py", line 665, in UserName
self._LoadUserIdentity()
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/project.py", line 678, in _LoadUserIdentity
u = self.bare_git.var('GIT_COMMITTER_IDENT')
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/project.py", line 3189, in runner
raise GitError('%s %s: %s' %
error.GitError: manifests var:
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
解决方案:
按上面提示进行设置即可
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
三、同步代码
repo sync
来源地址:https://blog.csdn.net/hp_2008/article/details/126349435