如何从BitBake配方中克隆私人git仓库?

kar*_*bar 1 git git-clone openembedded bitbake yocto

我对克隆私有git仓库的内容感兴趣,因此可以通过自定义BitBake配方使用它们.我尝试从Yocto Project邮件列表中调整这种技术,并产生以下内容:

SRC_URI = "git://www.example.com/path/to/repo;protocol=https;branch=master;name=commit;user=<username>:<password>
SRCREV_commit = "9f8309bbdf0632191bec21fada2cb61a30bcf53e"
Run Code Online (Sandbox Code Playgroud)

我正在使用的密码包含左括号.我收到此错误:

/bin/sh: -c: line 0: syntax error near unexpected token `)'
Run Code Online (Sandbox Code Playgroud)

我可以以某种方式逃避这个特殊角色,或者使用其他方式克隆回购?

Jur*_*aam 7

如另一条评论中所述,您也可以使用git + ssh:

SRC_URI = "git://git@some.private.url/path/to/repo;protocol=ssh"
Run Code Online (Sandbox Code Playgroud)

然后,您需要将运行bitbake的用户的公钥添加到git服务器.调试fetch为什么不起作用的一种好方法是实际用于ssh -v连接:

ssh -v git@some.private.url
Run Code Online (Sandbox Code Playgroud)

要注意git服务器实现(比如GitLab)之间的奇怪路径差异,例如,我们需要使用类似这样的东西(注意代字号)来使这些URI在Bitbake和Google Repo上工作:

SRC_URI = "git://git@some.private.url:~/groupname/repo.git;protocol=ssh;branch=${BRANCH}"
Run Code Online (Sandbox Code Playgroud)

  • 对于 github 私有仓库,我发现: `SRC_URI = "git://git@github.com:/username/repo.git;protocol=ssh;branch=${BRANCH}"` 工作得很好。感谢您的提示! (2认同)