repo sync x509: certificate is valid for,外部过滤器失败,smudge过滤器lfs失败,cannot initialize work tree

repo sync x509: certificate is valid for,外部过滤器失败,smudge过滤器lfs失败,cannot initialize work tree


目录
1.报错内容
2.打印错误log
3.error log解析
4.error解决


正文

1. 报错内容
现象: 第一次repo sync时,repo sync中途中断,未能将所有代码都down到本地。
停在error:cannot initialize work tree。
或者停在其他报错位置,error:外部过滤器失败,smudge过滤器失败,x509等等。

2.打印错误log
终端中使用命令:repo --trace sync,定位repo sync出错的具体git文件。
repo sync是读取多个gitconfig文件中的内容,以从远程down代码。
我打印出的log如下:

: export GIT_DIR=/home/username111/projFloder/projectName123/.repo/projects/出错的文件夹.git
: git rev-parse --verify refs/remotes/origin_binary/projectName123/milestone/^0 1>| 2>|
: cd /home/username111/projFloder/projectName123/出错的文件夹
: git read-tree --reset -u -v HEAD 1>| 2>|
Downloading full/bin/出错的文件1 (18 KB)
Error downloading object: full/bin/出错的文件1 (提交id): Smudge error: 
Error downloading full/bin/出错的文件1 (提交id): 
batch response: Post https://yyy.xxx.com/repository/projectName123_master/info/lfs/objects/batch: 
x509: certificate is valid for *.xxx.com, xxx.com, not yyy.xxx.com

Errors logged to /home/username111/projFloder/projectName123/出错的文件夹/.git/lfs/logs/......log
Use `git lfs logs last` to view the log.
error: 外部过滤器 'git-lfs filter-process' 失败
fatal: full/bin/出错的文件1:smudge 过滤器 lfs 失败
Traceback (most recent call last):
  ....(不需要关注的log)
error.GitError: cannot initialize work tree


3. error log解析

x509: certificate is valid for *.xxx.com, xxx.com, not yyy.xxx.com

这条log最重要,表示repo遍历到文件夹:/home/username111/projFloder/projectName123/出错的文件夹/ 时,根据文件夹中gitconfig的地址“https://yyy.xxx.com/repository/projectName123_master/info/lfs/objects/batch”无法从远程服务器“yyy.xxx.com”down代码。
因为本地的host文件只能转换出格式为:*.xxx.com, xxx.com的地址,无法转换格式为yyy.xxx.com

error.GitError: cannot initialize work tree

因为无法转换地址,所以无法连接到远程服务器,无法继续down代码,所以初始化work tree失败。

4.error解决

【错误:x509: certificate is valid for *.xxx.com, xxx.com, not yyy.xxx.com】
①先找到yyy.xxx.com的绝对地址。(方法:终端中ping yyy.xxx.com 终端会输出绝对地址:192.168.m.n)
②在host文件中声明yyy.xxx.com的绝对地址是192.168.m.n
-host文件位置:/etc/hosts
-文件添加内容:192.168.m.n yyy.xxx.com
③再次执行repo sync。如果再出现别的地址无法转换的问题,将新的无法转换的地址添加到hosts文件中。

【错误:error.GitError: cannot initialize work tree】
法一:如果报错只是因为repo中途异常中断,则再次执行repo sync -f即可;
法二:如果报错是因为上文x509,则需要先解决x509之后,再次执行repo sync或repo sync -f即可。

猜你喜欢

转载自blog.csdn.net/NeptuneYs/article/details/107380295