一、 下载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/
可以会遇到以下错误:
1、 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)
2、报以下错误:
Traceback (most recent call last):
File "/home/zjh/work/linux_Sunplus/app/.repo/repo/main.py", line 689, in <module>
_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 <lambda>
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"
三、同步代码文章来源:https://www.toymoban.com/news/detail-787445.html
repo sync 文章来源地址https://www.toymoban.com/news/detail-787445.html
到了这里,关于ubuntu20.04安装repo的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!