ubuntu22.04和ubuntu20.04 的ssh配置不然repo init失败

发布于:2025-06-13 ⋅ 阅读:(21) ⋅ 点赞:(0)

ubuntu22.04

Host *
        HostKeyAlgorithms +ssh-rsa
        pubkeyAcceptedKeyTypes +ssh-rsa
        KexAlgorithms +diffie-hellman-group1-sha1

ubuntu20.04

ubuntu@ubuntu-HP-ProDesk-480-G7-PCI-Microtower-PC:~/zyh$ cat ~/.ssh/config
Host *
    KexAlgorithms +diffie-hellman-group1-sha1
    StrictHostKeyChecking no

repo sync同步代码报错

Checking out projects:   2% (49/2440) platform/developmenterror: Cannot checkout device/amlogic/yukawa: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 7: ordinal not in range(128)
Traceback (most recent call last):
  File "/home/ubuntu/.bin/repo/main.py", line 541, in <module>
    _Main(sys.argv[1:])
  File "/home/ubuntu/.bin/repo/main.py", line 516, in _Main
    result = run()
  File "/home/ubuntu/.bin/repo/main.py", line 509, in <lambda>
    run = lambda: repo._Run(name, gopts, argv) or 0
  File "/home/ubuntu/.bin/repo/main.py", line 212, in _Run
    result = cmd.Execute(copts, cargs)
  File "/home/ubuntu/.bin/repo/subcmds/sync.py", line 994, in Execute
    self._Checkout(all_projects, opt)
  File "/home/ubuntu/.bin/repo/subcmds/sync.py", line 553, in _Checkout
    self._CheckoutWorker(**kwargs)
  File "/home/ubuntu/.bin/repo/subcmds/sync.py", line 435, in _CheckoutWorker
    return self._CheckoutOne(opt, project, *args, **kwargs)
  File "/home/ubuntu/.bin/repo/subcmds/sync.py", line 469, in _CheckoutOne
    project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
  File "/home/ubuntu/.bin/repo/project.py", line 1532, in Sync_LocalHalf
    self._InitWorkTree(force_sync=force_sync, submodules=submodules)
  File "/home/ubuntu/.bin/repo/project.py", line 2774, in _InitWorkTree
    _lwrite(os.path.join(tmpdotgit, HEAD), '%s\n' % self.GetRevisionId())
  File "/home/ubuntu/.bin/repo/project.py", line 1516, in GetRevisionId
    return self.bare_git.rev_parse('--verify', '%s^0' % rev)
  File "/home/ubuntu/.bin/repo/project.py", line 3046, in runner
    (self._project.name, name, p.stderr))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 7: ordinal not in range(128)

从你给出的错误信息可知,repo sync 同步代码时出现了 UnicodeDecodeError 错误,此错误通常是因为 Python 在尝试使用 ascii 编解码器对包含非 ASCII 字符的字符串进行解码时引发的。

echo 'export PYTHONIOENCODING=utf-8' >> ~/.bashrc
echo 'export LC_ALL=en_US.UTF-8' >> ~/.bashrc
source ~/.bashrc